Amateur2005
September 18th, 2005, 06:35 AM
Hello all..
I'm very new to programming with Visual C++.. i'm trying to do serial commuincation (rs232) with a microconcontroller.. i was bit unclear on the ReadFile() function.. if i work in the non-overlapped mode.. will
I declare char buffer[2000];
then i call ReadFile() as:
ReadFile(h, buffer, sizeof(buffer)-1, &bytesRead, 0)
So will ReadFile() only return when i've read in 2000 characters (no less) into buffer ?
What i actually want to do in the end is that when some data is recieved into the serial port i need to check what the 1st character is and then after that if it is say a '#' then store the next 18 bytes into a mysql database..then check again what the next character is..
I'm really confused as how to go about this.. as the data can come in any time.. the program has to sit and monitor if data is coming in and then decide what to do with depending on what it is..
Please help with any ways to go about this.. Thank you..
I'm very new to programming with Visual C++.. i'm trying to do serial commuincation (rs232) with a microconcontroller.. i was bit unclear on the ReadFile() function.. if i work in the non-overlapped mode.. will
I declare char buffer[2000];
then i call ReadFile() as:
ReadFile(h, buffer, sizeof(buffer)-1, &bytesRead, 0)
So will ReadFile() only return when i've read in 2000 characters (no less) into buffer ?
What i actually want to do in the end is that when some data is recieved into the serial port i need to check what the 1st character is and then after that if it is say a '#' then store the next 18 bytes into a mysql database..then check again what the next character is..
I'm really confused as how to go about this.. as the data can come in any time.. the program has to sit and monitor if data is coming in and then decide what to do with depending on what it is..
Please help with any ways to go about this.. Thank you..