Nested strtok function problem in C [duplicate]
You cannot do that with strtok(); use strtok_r() from POSIX or strtok_s() from Microsoft if they are available, or rethink your design. char *strtok_r(char *restrict s, const char *restrict sep, char **restrict lasts); char *strtok_s(char *strToken, const char *strDelimit, char **context); These two functions are interchangeable. Note that a variant strtok_s() is specified in an … Read more