/* strtok example */
#include <stdio.h>
#include <string.h>
int main ()
{
char str[] ="current position=100";
char * pch;
printf ("Splitting string \"%s\" into tokens:\n",str);
pch = strtok (str,"=");
while (pch != NULL)
{
printf ("%s\n",pch);
pch = strtok (NULL, "=");
}
return 0;
}
Output:
Splitting string "current position=100" into tokens:
current position
100