When I don't call the same function in my code, everything works fine, but when the function returns from recursion all of a sudden, the pch variable is NULL:
void someFunction() { char * pch; char tempDependencies[100*64+100]; strcpy(tempDependencies,map[j].filesNeeded); pch = strtok(tempDependencies,","); while (pch != NULL) { someFunction(); <- if i comment this out it works fine pch = strtok (NULL, ","); } }
So, for example, when the loop acts on the line file2,file3,file4 , it correctly splits file2 and changes the line to file2\\000file3,file4 , but the next call is pch = strtok (NULL, ","); displays pch as 0x0 . Are there things I don't know about when calling recursion?
source share