How to parse a string separated by commas?
Modified from cplusplus strtok
example:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main ()
{
char str[] ="1,2,3,4,5";
char *pt;
pt = strtok (str,",");
while (pt != NULL) {
int a = atoi(pt);
printf("%d\n", a);
pt = strtok (NULL, ",");
}
return 0;
}