Posted on 2002-06-14
On the first call to strtok, the function skips leading delimiters and returns a pointer to the first token in the string. Then it puts a NULL in and carries on from where it left off.
Using the this string with delimiters is fine…
I get all the tokens out in order as expected. However I have to deal with situations where some of the fields are blank, so there will be two fence characters side by side. And I want to know which fields are empty.
So with a string like this…
I want to get this result…
Field 2: GREEN
Field 4: YELLOW
Field 5: ORANGE
Field 6: PINK
Field 8: BLACK
I know that my records should have 8 fields each. But I need to know which are empty, even the ones at the start and the end.