Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include <sys/types.h>
  3. #include <sys/wait.h>
  4. #include <unistd.h>
  5. using namespace std;
  6. char* argv[50];
  7. int main()
  8. {
  9. std::ios::sync_with_stdio(false);
  10. char line[255];
  11. int cnt=0;
  12. fgets(line,255,stdin);
  13. printf("%s",line);
  14. char* split=strtok(line," ");
  15. while(split!=NULL){
  16. argv[cnt++]=split;
  17. split=strtok(NULL," ");
  18. }
  19. printf("%d",cnt);
  20. if(!fork()){
  21.  
  22. }
  23. else {
  24. wait(0);
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement