strtok_r is the reentrant variant of strtok. It is POSIX-conformant. However, it is missing from MinGW, and I'm trying to compile a program that is using it.
Is there any way I could add a standard implementation of this function, perhaps to the project's own code, or to MinGW's standard library functions?
Since there are some license questions about the code from another answer, here's one that's explicitly public domain:
MINGW has no implementation of
strtok_r
. However you can find a thread-safe implementation in the link below:http://www.raspberryginger.com/jbailey/minix/html/strtok__r_8c-source.html
Is the FreeBSD implementation any use to you?
Its liberally licensed but integrating it may have some requirements on your project documentation (adding an acknowledgement that the code has been included).
Here's the source code which you can simply add to your own library/function in your project: