Usually when reading from a file, then one reads in small chunks like one byte at a time.
If using a wrapper around ReadFile like fstream, then it will perform readahead caching by reading large chunks from the file into memory. When reading small chunks from fstream, then it will actually read directly from the internal cache inside fstream.
It depends on how you want to send the info to your server(whether it's in XML format or some other format). If it's XML use IXMLHTTPRequestPtr::open() to connect with the server and IXMLHTTPRequestPtr::send() to send ur XML content to the server. IXMLHTTPRequestPtr::responseText; to get the response from server.
Some body has already posted the whole code for this at the XML/XSL forum. See the reply of pix_programmer.Link below:
can i use POST method for this operation and function?
I didn't fully understand your question. You can call open() function with "POST" as first parameter and the url or IP address of ur server as second parameter. Please go through the link I've given. It contains code that can be used as such if you are working with a VC++/MFC or a Win32 project.
I would almost venture to say raw sockets over your own API is the best method for a learner... everything else, including HTML/XML/Web Services is based on the socket foundation. So understanding sockets can be a great foundation.
Either use MFC wrapper classes or Windows API (try sockets, unless you want to write a totally custom driver). Use the Linux API sets for programs that you want to run on Linux. Alternatively you could use a third party networking solution (library), but I recommend coding a front end networking class that will load up different definition files based on the values of a set of macros (ex. #define OS WINDOWS). If your object oriented skills are up to par, then it should be no problem to write it once and port it to future programs, occasionally modifying the definitions based on the API updates/changes for each respective operating system you want to support.
I compiled a MFC application in debug mode.
When I run the program, most time, it was OK, but in a few times, it occurred following error:
-abort() has been called
(Press Retry to debug the application)
Last night, I left the program running, it also occurred such error.
Now I let the program run for two hours，but the error has not occurred yet.
It seems the error occurred randomly, how can I get rid of the annoying problem .
This is an error probably from CRT... like Richard already mentioned, if you debug, you should be able to see both why the abort() was called and what part of your code triggered it (look through call stack).
Q: What's the best way to eat an elephant?
A: One bite at a time.
Have you tried narrowing down the problem to something a bit more manageable? In other words, if you've got a 1000-line program and something is wrong, rather than look at each line with equal suspicion, remove (irrelevant) lines until the problem goes away. Or, start over and add lines until problem appears. This way you can focus your effort on a much smaller problem.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
I have a CDialog derived class named CCalibrationDialog. As the name shows I want that dialog to control a procedure of a calibration (non-relevant: camera shutter/gain calibration). I would love to be able to show the progress of this procedure with a CProgressCtrl object but I have a little (maybe dumb) problem. I follow every step of this tutorial (http://www.codersource.net/mfc/mfc-tutorials/cprogressctrl.aspx[^]) which seems to show the easiest way to control the progress bar but my program asserts as if the CProgressCtrl is not initialized.
What you showed should be fine. I'm guessing at your call to progressctrl.SetRange() the progress control's HWND is 0/NULL, yes? If so, it sounds like the progress control with a matching ID isn't being found on the dialog form.
Since I needed a way to stop / disable COM port DTR signal I have ventured into unknown territory of multithreading . I am making progress.
Now I need to use same approach to start / stop audio recording.
I am using waveInOpen function with CALLBACK_FUNTION.
Upon receiving the WIM_DATA the callback function will run the worker thread.
However,waveInOpen has an option to use CALLBACK_THREAD and I am unable to find any examples on how it can be used.
Since using callback can be challenging, it is for me, I like the callback function giving me feedback aka – WIM_OPEN.
How can I get that response from CALLBACK_THREAD / worker thread?
I am coding in VC++ / MFC, please do not waste your and mine time suggesting alternative development tools.
Any constructive help will be as always appreciated..
Use can use CreateThread to first create a thread.
The last parameter of CreateThread will give you the identifier of the thread that you pass in the dwCallback parameter of waveInOpen.
In the thread function, you can have a GetMessage loop to retrieve the messages being sent to the thread which are MM_WIM_OPEN, MM_WIM_CLOSE, and MM_WIM_DATA.
«_Superman_» I love work. It gives me something to do between weekends.