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 the
Here's the source code which you can simply add to your own library/function in your project:
char *strtok_r(char *str, const char *delim, char **save)
{
char *res, *last;
if( !save )
return strtok(str, delim);
if( !str && !(str = *save) )
return NULL;
last = str + strlen(str);
if( (*save = res = strtok(str, delim)) )
{
*save += strlen(res);
if( *save < last )
(*save)++;
else
*save = NULL;
}
return res;
}