Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <unistd.h>
- int potok[2];
- int main(){
- pipe(potok); // utworzenie potoku pipe
- switch(fork()) // tworznie procesu
- {
- case -1: // blad utworzenia
- exit(1);
- case 0: // potomny po A
- close(1);
- dup(potok[1]); // wpisanie do potoku
- close(potok[0]);
- execlp("finger", "finger", NULL);
- exit(0);
- default: // macierzysty A
- {
- wait();
- close(0);
- dup(potok[0]); // odczyt z potoku
- close(potok[1]);
- execlp("cut", "cut", "-d ", "-f1", NULL);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement