Pipes
Parent-child communication.
What Is a Pipe
A pipe is a one-way communication channel between related processes. One process writes bytes into it and another reads them out, like a conveyor belt of data.
Two File Descriptors
The pipe() call fills a two-element array: fd[0] is the read end and fd[1] is the write end. Data written to fd[1] can be read from fd[0].
#include <unistd.h>
#include <stdio.h>
int make_pipe(int fd[2]) {
if (pipe(fd) < 0) { perror("pipe"); return -1; }
/* fd[0] read end, fd[1] write end */
return 0;
}