#include <stdio.h>
#include <stdlib.h>
#include <securec.h>
int main(int argc, char *argv[])
{
char str[] = "1,2,3,4,5";
const char *sep = ",";
char *pStr = NULL;
pStr = strtok(str, sep);
while (pStr != NULL) {
printf("%c\n", pStr[0]);
/* printf("%s\n", pStr); */
pStr = strtok(NULL, sep);
}
char str2[] = "1,2,3,4,5";
char *delim = ",";
char *context = NULL;
char *pStr2 = NULL;
pStr2 = strtok_s(str2, delim, &context);
while (pStr2 != NULL) {
printf("%c\n", pStr2[0]);
pStr2 = strtok_s(NULL, delim, &context);
}
return 0;
}