#include #include #include main() { const int RESPONSE_FD = 63; int pfd[2], status, size; char buffer[100]; status = pipe(pfd); if(status == -1) { printf("Could not open pipe\n"); exit(1); } else { printf("The filedescriptors are: %d %d\n", pfd[0], pfd[1]); } status = fork(); if(status == 0) { printf("This is the child\n"); status = dup2(pfd[0], RESPONSE_FD); if(status == -1) { printf("dup2 failed\n"); exit(1); } close(pfd[1]); close(pfd[0]); while(read(STDIN_FILENO, buffer, sizeof(buffer))>0) { printf("%s", buffer); } } else { printf("This is the parent\n"); system("my_prog.pl"); } }