Click here to Skip to main content
15,913,758 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VC++ & Interbase Pin
Eytukan3-Oct-05 7:11
Eytukan3-Oct-05 7:11 
Questionstatic text Pin
FarPointer29-Sep-05 3:58
FarPointer29-Sep-05 3:58 
AnswerRe: static text Pin
Ashok Dhamija29-Sep-05 5:06
Ashok Dhamija29-Sep-05 5:06 
GeneralRe: static text Pin
FarPointer29-Sep-05 7:34
FarPointer29-Sep-05 7:34 
GeneralRe: static text Pin
ThatsAlok29-Sep-05 18:04
ThatsAlok29-Sep-05 18:04 
AnswerRe: static text Pin
douglasjordan29-Sep-05 10:38
douglasjordan29-Sep-05 10:38 
QuestionIssues with ReadFile function Pin
Aditi48429-Sep-05 3:47
Aditi48429-Sep-05 3:47 
AnswerRe: Issues with ReadFile function Pin
Cedric Moonen29-Sep-05 4:05
Cedric Moonen29-Sep-05 4:05 
You have serveral solutions to this 'problem'. First, it is not a problem but a normal behavior: you are reading the serial buffer faster than the data is coming in, so depending on the timeout you specified for the serial port, you will probably have only a part of the data.

One solution is to read the string in several times: you keep a counter that says how much bytes needs still to be read and this counter will be also used as index to write the data in an array.

Second solution is to set timeout parameters of your serial port big enough to have the time to read the entire data. You can set timeouts by using the SetCommTimeouts function.

I prefer the first solution because it is more secure, even if you have some unexpected latency somewhere. And still, your device can send data not continuesly so you have to know when start reading then. Or you can use complete blocking reading but that's not a good solution neither: if your device stop, your program will hung.

Another thing: are you running this loop in a separate thread ? If no, I suggest to do so, like that it won't interfere with the user interface handling.
GeneralRe: Issues with ReadFile function Pin
Aditi48429-Sep-05 4:34
Aditi48429-Sep-05 4:34 
AnswerRe: Issues with ReadFile function Pin
David Crow29-Sep-05 7:05
David Crow29-Sep-05 7:05 
AnswerRe: Issues with ReadFile function Pin
Aditi48430-Sep-05 2:59
Aditi48430-Sep-05 2:59 
GeneralRe: Issues with ReadFile function Pin
David Crow30-Sep-05 3:13
David Crow30-Sep-05 3:13 
GeneralRe: Issues with ReadFile function Pin
Aditi48430-Sep-05 4:28
Aditi48430-Sep-05 4:28 
GeneralRe: Issues with ReadFile function Pin
David Crow30-Sep-05 4:49
David Crow30-Sep-05 4:49 
GeneralRe: Issues with ReadFile function Pin
Aditi48430-Sep-05 5:21
Aditi48430-Sep-05 5:21 
GeneralRe: Issues with ReadFile function Pin
David Crow30-Sep-05 5:29
David Crow30-Sep-05 5:29 
GeneralRe: Issues with ReadFile function Pin
Aditi4841-Oct-05 5:06
Aditi4841-Oct-05 5:06 
QuestionPrinting centimeters Pin
Ivan Cachicatari29-Sep-05 2:53
Ivan Cachicatari29-Sep-05 2:53 
AnswerRe: Printing centimeters Pin
bugDanny29-Sep-05 3:08
bugDanny29-Sep-05 3:08 
AnswerRe: Printing centimeters Pin
vikas amin29-Sep-05 3:24
vikas amin29-Sep-05 3:24 
QuestionC++ loading XML Pin
SpuddyMcFuddy29-Sep-05 2:42
SpuddyMcFuddy29-Sep-05 2:42 
AnswerRe: C++ loading XML Pin
David Crow29-Sep-05 3:03
David Crow29-Sep-05 3:03 
AnswerRe: C++ loading XML Pin
Marc Soleda29-Sep-05 3:13
Marc Soleda29-Sep-05 3:13 
AnswerRe: C++ loading XML Pin
ThatsAlok29-Sep-05 18:07
ThatsAlok29-Sep-05 18:07 
QuestionExecuting an exe with Run As programmatically Pin
Tariq87829-Sep-05 2:15
Tariq87829-Sep-05 2:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.