Strings including string literals are supposed to be writable for strtok() to work. Const char * is a modern c construct. You gotta deprecate parts of the standard c library, which will break backward compatibility...
Strings including string literals are supposed to be writable for strtok() to work. Const char * is a modern c construct. You gotta deprecate parts of the standard c library, which will break backward compatibility...
Using strtok on a string literal has been undefined behavior since ANSI C 89.
The standard C library uses const char * almost everywhere where a string is accepted that will not be modified.
I have a strtok() clone for this purpose that returns a pointer range for each token, leaving the string untouched.
But then you have to copy out those pieces in order to have them null terminated so they can correctly function as strings.