7

piping two times using fork in C linux

view full story
linux-howto

http://stackoverflow.com – I am trying to rewrite a c program that do something like ls|wc|wc , I already did it for ls|wc , it worked fine, but I can't figure out why my program stops at the child in the indicated line. please help! int main (void) { pid_t pid_fils, pid_pfils; int fd[2], fd2[2]; if(pipe(fd)==-1 || pipe(fd2)==-1) { printf("pipe failed!"); return 1; } printf("program started\n"); pid_fils=fork(); if(pid_fils==0) { pid_pfils=fork(); if(pid_pfils==0) { //action3 printf("I am the grandson\n"); (HowTos)