fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <string.h>
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8. char somestr[] ="2,0100,0200,0100";
  9. char *pt;
  10. pt = strtok (somestr,",");
  11. while (pt != NULL) {
  12. int a = atoi(pt);
  13. printf("%d\n", a);
  14. pt = strtok (NULL, ",");
  15. }
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 1832KB
stdin
Standard input is empty
stdout
2
100
200
100