fork(2) download
  1. #include <stdio.h>
  2.  
  3.  
  4.  
  5. int main()
  6.  
  7. {
  8.  
  9. const char* var_text = "cat /etc/passwd | cut -f1 d: | sort";
  10.  
  11. char cm1[100];
  12.  
  13. char cm2[100];
  14.  
  15. char cm3[100];
  16.  
  17. if (3 == sscanf(var_text, "%99[^|]| %99[^|]| %99s", cm1, cm2, cm3))
  18.  
  19. {
  20.  
  21. printf("<%s>\n", cm1);
  22.  
  23. printf("<%s>\n", cm2);
  24.  
  25. printf("<%s>\n", cm3);
  26.  
  27. }
  28.  
  29. return 0;
  30.  
  31. }
  32.  
  33.  
Success #stdin #stdout 0.01s 1676KB
stdin
Standard input is empty
stdout
<cat /etc/passwd >
<cut -f1 d: >
<sort>