Just be aware that strtok in its traditional form uses static variables as
>>4 mentioned and is thus non-reentrant. It's actually trivial to implement a reentrant strtok, though it would require you to pass in current state of tokenization on each function call