Did you feed strtok a temporary string? It's better to use your own buffer.

I believe strtok actually modifies the original string that you supply, adding null terminators and pointing to a specific character in your supplied buffer to get substrings.