I faced a problem with "strtok" as I programmed a function which checked a directory (string) on existance and if it does not exist it would create that directory. That problem did only occur if in that "strtok"-broken string is a '\\' at the end of the string.
Example: Directory-string is "E:\\xyz\\uvw\\abc\\qwertz\\bnm\\".
The function tests if "E:\\xyz" exists and if not it creates it.
The function tests if "E:\\xyz\\uvw" exists and if not it creates it.
... and so on...
The function tests if"E:\\xyz\\uvw\\abc\\qwertz\\bnm" exists and if not it creates it.
After using that function with directory-string "E:\\xyz\\uvw\\abc\\qwertz\\bnm\\" I use an other function with that directory-string "E:\\xyz\\uvw\\abc\\qwertz\\bnm\\" as a parameter (creating a file inside - a text-log file!). But now in that second function (in debug-mode!) the directory-string "E:\\xyz\\uvw\\abc\\qwertz\\bnm\\" is only "E" - nothing more! The rest is missing!
BUT if I use the directory-string "E:\\xyz\\uvw\\abc\\qwertz\\bnm" instead the directory-string "E:\\xyz\\uvw\\abc\\qwertz\\bnm\\" in the next function is "E:\\xyz\\uvw\\abc\\qwertz\\bnm\\" !!!!
It is so that "strtok" results an error inside the compiler which influences the string-parameter of a following function.
Maybe it influences in general the following string but I didn't test that.
My solution was:
I check the string in the first function on '\\' at it's end. If there is '\\' I cut it away - as long as there is a '\\' and the string is longer than 1 !