1d20fc50192850bce84bb111c0509dcf84da7ba3
13 if (pipe(pipefd
) == -1) {
14 perror("Pipe creation failure\n");
21 perror("fork failure\n");
23 } else if (cpid
== 0) {
25 dup2(pipefd
[1], STDOUT_FILENO
);
26 execl("/bin/ls", "ls", (char*)NULL
);
31 printf("[%d] REDIRECTION: \n", getpid());
32 while (read(pipefd
[0], &tmpbuf
, 1) > 0) {
33 write(STDOUT_FILENO
, &tmpbuf
, 1);