Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- #include <unistd.h>
- using namespace std;
- char* argv[50];
- int main()
- {
- std::ios::sync_with_stdio(false);
- char line[255];
- int cnt=0;
- fgets(line,255,stdin);
- printf("%s",line);
- char* split=strtok(line," ");
- while(split!=NULL){
- argv[cnt++]=split;
- split=strtok(NULL," ");
- }
- printf("%d",cnt);
- if(!fork()){
- }
- else {
- wait(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement