fork download
  1. /* strtok example */
  2. #include <stdio.h>
  3. #include <string.h>
  4.  
  5. int main ()
  6. {
  7. char str[] ="man{0,1,2,3}";
  8. char * pch;
  9. printf ("Splitting string \"%s\" into tokens:\n",str);
  10. pch = strtok (str,"{},");
  11. while (pch != NULL)
  12. {
  13. printf ("%s\n",pch);
  14. pch = strtok (NULL, "{},");
  15. }
  16. return 0;
  17. }
Success #stdin #stdout 0.01s 2680KB
stdin
Standard input is empty
stdout
Splitting string "man{0,1,2,3}" into tokens:
man
0
1
2
3