Click here to Skip to main content
16,004,919 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: calculating function time,Interesting Pin
John R. Shaw13-Sep-05 2:44
John R. Shaw13-Sep-05 2:44 
QuestionRe: calculating function time,Interesting Pin
logicaldna13-Sep-05 18:42
logicaldna13-Sep-05 18:42 
QuestionNobody??WMI,set Ip Address,Doesn't work! Help!!! Pin
Tcpip200513-Sep-05 0:51
Tcpip200513-Sep-05 0:51 
QuestionI got runtime error when I am moving toolbars in my program. Pin
G Haranadh13-Sep-05 0:14
G Haranadh13-Sep-05 0:14 
QuestionSerial communication Pin
Aditi48412-Sep-05 23:59
Aditi48412-Sep-05 23:59 
AnswerRe: Serial communication Pin
MailtoGops13-Sep-05 3:15
MailtoGops13-Sep-05 3:15 
GeneralRe: Serial communication Pin
Aditi48413-Sep-05 3:50
Aditi48413-Sep-05 3:50 
AnswerRe: Serial communication Pin
John R. Shaw13-Sep-05 4:06
John R. Shaw13-Sep-05 4:06 
We need more beginners like you. You have good instincts as to how to figure out what the problem is. (You also have the option of using the TRACE() marcos, as well as printf(), in order to print debugging resutls).

Unfortunaley your code is good enough that it should probably be working. It does need improvement, but that's not the problem. What the problem is I do not know and I've written severial serial communications programs. In otherwords, I'd have to be degugging it.

SOME COMMENTS:
1) CreateFile() doesn't return 0 on failure, it returns INVALID_HANDLE_VALUE (which is equal to -1). All this tells us it that even thou your code does not know if it failed to open a port, it has succeded because you are receiving data. (Oh, if it did fail you code would report that it fail to open port 1 not 3).
2) Use: if(result) {...} else {...}. Not: if(result) {...} if(!resutl) {...}
3) If ReadFile() succededs then bytesRead should not be 0, so checking for it makes no since.

GARBAGE IS A RELITIVE TERM:
1) Your code implies that you are expecting to receive (ASCII) text. If that is not what the microcontroller is returning, then it will look like garbage.
2) What are you expecting to receive from the microcontroller?

FYI:
I assume you know that you are writting C code and not C++ code.
(It has no effect on your problem or its solution).


INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
AnswerRe: Serial communication Pin
Roger Stoltz13-Sep-05 6:35
Roger Stoltz13-Sep-05 6:35 
GeneralRe: Serial communication Pin
Aditi48413-Sep-05 23:26
Aditi48413-Sep-05 23:26 
AnswerRe: Serial communication Pin
Roger Stoltz14-Sep-05 1:00
Roger Stoltz14-Sep-05 1:00 
AnswerRe: Serial communication Pin
Aditi48414-Sep-05 1:36
Aditi48414-Sep-05 1:36 
GeneralRe: Serial communication Pin
Roger Stoltz14-Sep-05 5:00
Roger Stoltz14-Sep-05 5:00 
AnswerRe: Serial communication Pin
Aditi48415-Sep-05 21:51
Aditi48415-Sep-05 21:51 
QuestionHow to add a Scheduled Task to the Task Scheduler Pin
PravinSingh12-Sep-05 23:55
PravinSingh12-Sep-05 23:55 
AnswerRe: How to add a Scheduled Task to the Task Scheduler Pin
prasad_som13-Sep-05 0:03
prasad_som13-Sep-05 0:03 
AnswerRe: How to add a Scheduled Task to the Task Scheduler Pin
David Crow13-Sep-05 2:30
David Crow13-Sep-05 2:30 
Questionmemory management Pin
Ali Tavakol12-Sep-05 23:55
Ali Tavakol12-Sep-05 23:55 
Questionserver and client Pin
Member 216100412-Sep-05 23:54
Member 216100412-Sep-05 23:54 
QuestionCDC::SelectObject Pin
Nishad S12-Sep-05 23:33
Nishad S12-Sep-05 23:33 
AnswerRe: CDC::SelectObject Pin
ThatsAlok12-Sep-05 23:48
ThatsAlok12-Sep-05 23:48 
AnswerRe: CDC::SelectObject Pin
John R. Shaw13-Sep-05 5:48
John R. Shaw13-Sep-05 5:48 
QuestionLimited number of controls on a dialog? Pin
Mircea Puiu12-Sep-05 22:27
Mircea Puiu12-Sep-05 22:27 
AnswerRe: Limited number of controls on a dialog? Pin
toxcct12-Sep-05 22:30
toxcct12-Sep-05 22:30 
GeneralRe: Limited number of controls on a dialog? Pin
Mircea Puiu12-Sep-05 22:52
Mircea Puiu12-Sep-05 22:52 

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.