I\'m trying to use this function in a C program that needs to be able to compile in Linux and Windows. At first I tried using strtok_r, but then when I compiled on windows,
strtok_s is simply the Windows version of strtok_r which is standard everywhere else.
One (common I would think) way to make a program portable when it comes to functions like strtok_s/strtok_r is to use the preprocessor:
#if defined(_WIN32) || defined(_WIN64)
/* We are on Windows */
# define strtok_r strtok_s
#endif
As the prototypes and functionality is the same, you can now use only strtok_r.