Originally Posted by
robin2aj
so I should be able to do this?
[code]
sscanf(token, "%d,%d,%[^NULL]", &type, &code, description);
[\code]
Unless your description has a N, U, or L in it, in which case you're in trouble.
The point is that this:
Code:
sscanf(token, "%d,%d,%[^\n]", &type, &code, description);
does not need a new-line character to stop. It will stop when the string runs out of data, all by itself. But every character in your token string after the second comma that matches "does not equal \n" will be added to description.
EDIT: Sorry, that last sentence is a little incorrect. What I mean is that, starting at the second comma, every character will be checked; if it matches "does not equal \n", it will be added to description and we continue; if we run out of data, or we find a character that doesn't match, we stop (so no further characters are added).