isspace!?
-
Hello i'm trying to use this do-while loop but it seems that it doesn't work the way I like it to: char szBuffer[18]; do { serial.Read(szBuffer,nBuflen,&dwBytesRead); szBuffer[dwBytesRead] = '\0'; } while (isspace(szBuffer[0])==0);
-
Hello i'm trying to use this do-while loop but it seems that it doesn't work the way I like it to: char szBuffer[18]; do { serial.Read(szBuffer,nBuflen,&dwBytesRead); szBuffer[dwBytesRead] = '\0'; } while (isspace(szBuffer[0])==0);
Where are you incrementing the loop ??? What is your requirement exactly ??
Appu.. "If you judge people, you have no time to love them."
-
Where are you incrementing the loop ??? What is your requirement exactly ??
Appu.. "If you judge people, you have no time to love them."
My question was am I using isspace the right way? should i include or define smth to use isspace? The loop is incremented in the serial.Read(...) function.
-
My question was am I using isspace the right way? should i include or define smth to use isspace? The loop is incremented in the serial.Read(...) function.
Well isspace returns true if it is a white space character, and false if it's a real character. Did you post a code fragment, or was it all the code?
- S 50 cups of coffee and you know it's on!
-
Well isspace returns true if it is a white space character, and false if it's a real character. Did you post a code fragment, or was it all the code?
- S 50 cups of coffee and you know it's on!
It is wrong.To find out the reason chk this. http://msdn2.microsoft.com/en-us/library/x9wa4512.aspx[^]
Appu.. "If you judge people, you have no time to love them."
-
It is wrong.To find out the reason chk this. http://msdn2.microsoft.com/en-us/library/x9wa4512.aspx[^]
Appu.. "If you judge people, you have no time to love them."
Yeah, that just repeats what I said. How is it "wrong"?
- S 50 cups of coffee and you know it's on!
-
Hello i'm trying to use this do-while loop but it seems that it doesn't work the way I like it to: char szBuffer[18]; do { serial.Read(szBuffer,nBuflen,&dwBytesRead); szBuffer[dwBytesRead] = '\0'; } while (isspace(szBuffer[0])==0);
What is it "isspace"?
_**
**_
whitesky
-
Yeah, that just repeats what I said. How is it "wrong"?
- S 50 cups of coffee and you know it's on!
The loop should continue until I have non-space caractert e.g. szBuffer[0] != ' ' or szBuffer[0] != '\r', well, it doesn't...
-
It is wrong.To find out the reason chk this. http://msdn2.microsoft.com/en-us/library/x9wa4512.aspx[^]
Appu.. "If you judge people, you have no time to love them."
Maybe i'm a bit stupid but looking at your link still let me confused. I still don't get what am I doing wrong.
-
The loop should continue until I have non-space caractert e.g. szBuffer[0] != ' ' or szBuffer[0] != '\r', well, it doesn't...
Yeah, I was referring to the post "It is wrong"...
- S 50 cups of coffee and you know it's on!
-
Hello i'm trying to use this do-while loop but it seems that it doesn't work the way I like it to: char szBuffer[18]; do { serial.Read(szBuffer,nBuflen,&dwBytesRead); szBuffer[dwBytesRead] = '\0'; } while (isspace(szBuffer[0])==0);
So, what's the real problem? Does the loop exit immediately? Could be a timing issue. It doesn't seem like you ever do anything with szBuffer, or maybe you left that code out. Everytime you call serial.Read, it's going to overwrite your szBuffer, and you'll lose what's in it, unless you copy it somewhere.
- S 50 cups of coffee and you know it's on!
-
The loop should continue until I have non-space caractert e.g. szBuffer[0] != ' ' or szBuffer[0] != '\r', well, it doesn't...
So what is the value of
szBuffer[0]
when the loop terminates?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb