I'm trying to parse a comma separated string. The function that I wrote requires an ending comma at the end of the string since that's what I'm checking for. But I wanted to add an extra "cmp byte ptr,xx" to test for a carriage return/line feed. I know that'll be a word and I'm testing for a byte, so I was just testing for the line feed which is 10d/0ah but it's not working. I'm not sure what the real difference is so I tested for 13d/0dh as well.

So what ascii value or character should I be testing for to indicate the crlf? I'll post code if that's necessary but it's just a cmp.


thanks,
will
Posted on 2003-04-25 14:58:24 by Will
This all depends on what program prepared the text you are parsing. Some will add both, in either order, some may insert only one (most probably the 0Dh cr) . Without any prior knowledge, it's always safer to do a cmp for both bytes individually.

When you find one, you check again for the second one in case both have been inserted, and then repeat the entire check again just in case a double (or more) crlf precedes the next "line".

Raymond
Posted on 2003-04-25 15:57:00 by Raymond
It's a buffer from a GetPrivateProfileString call. I was being stupid. Just needed to test for the null termination. It's working fine now.


thanks,
will
Posted on 2003-04-25 16:16:47 by Will