Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int toSub[2], fromSub[2];
- if(!pipe(toSub)) return 1;
- if(!pipe(fromSub)) return 1;
- if( fork() )
- {
- while(1)
- {
- if(!read(fromSub[0], &c, 1)) break;
- send(sockfd, &c, 1, 0);
- printf("in-%c\n", c);
- if(!recv(sockfd, &c, 1, 0)) break;
- send(toSub[1], &c, 1, 0);
- printf("out-%c\n", c);
- }
- }
- else
- {
- dup2(toSub[0], 0);
- dup2(fromSub[1], 1);
- execlp("rz", "rz", (char*) NULL);
- }
- puts("done");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement