8

pipe-ing for three processes confusion in C

view full story
linux-howto

http://stackoverflow.com – I am studying System Programming for Linux. I am working with pipes right now, I successfully did a pipe between two processes only, but when it comes to more than two processes I get confused because some times it works and sometimes it does not for the SAME code!! Here is my code, trying to simulate this command (ls -l | sort | grep .c): int main() { int p1[2]; pipe(p1); switch(fork()) { case -1: perror("Fork error"); break; case 0: switch(fork()) { case -1: perror("Fork error"); (HowTos)