/* David A. Hess Fork example assignment */ #include #define EOF 0 int i,x; int fd[2]; int stat; char buffer[80]; static char nh[11] = "NEW HAMPSH"; static char bos[11] = "BOSTON "; main() { printf("how many times\n"); scanf("%d",&x); if (pipe(fd) == -1) { perror("pipe 1 : pipe"); exit(1); } dofork1(); } dofork2() { if((stat = fork()) == -1) { perror("pipe 1 : fork"); exit(1); } else { if (stat == 0) { for (i=0;i 0) { dofork2(); close(fd[1]); while(read(fd[0],buffer,10) != EOF) printf("PARENT READS =>:%s\n",buffer); exit(0); } else if(stat == 0) { for (i=0;i