fork(3) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main()
  6. {
  7. const char* X = "hello again there";
  8. char token[1000];
  9. int current_pos = 0;
  10. int pos = 0;
  11. while (1 == sscanf(X + current_pos, "%999s%n", token, &pos))
  12. {
  13. current_pos += pos;
  14. printf("%s | %s\n", token, X + current_pos);
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 1720KB
stdin
Standard input is empty
stdout
hello |  again there
again |  there
there |