fork(4) download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void){
  5. char Input[] = "1st-2nd.3rd;4th.";
  6. char *token;
  7. token = strtok(Input, "-");
  8. printf("first: %s\n", token);
  9.  
  10. token = strtok(NULL, ".");
  11. printf("second: %s\n", token);
  12.  
  13. token = strtok(NULL, ";");
  14. printf("third: %s\n", token);
  15.  
  16. token = strtok(NULL, ".");
  17. printf("forth: %s\n", token);
  18. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
first: 1st
second: 2nd
third: 3rd
forth: 4th