strtok. How to complete the analysis


On page there is text that I must to finish parsing of previous string before to parse next:


Each function uses a thread-local static variable for parsing the string into tokens. Therefore, multiple threads can simultaneously call these functions without undesirable effects. However, within a single thread, interleaving calls to one of these functions is highly likely to produce data corruption and inaccurate results. When parsing different strings, finish parsing one string before starting to parse the next. Also, be aware of the potential for danger when calling one of these functions from within a loop where another function is called. If the other function ends up using one of these functions, an interleaved sequence of calls will result, triggering data corruption.

What does that mean? For example I need only first token. Must I continue call strtok(null, ) to finish or I can call strtok(string2, )?

If you are using a program without successive strtok calls between different threads you can just get the first token as you want to, and then continue using strtok on other strings without a problem.