pipe
Prototype:
#include <unistd.h>
int pipe(fd[2]);
General Description: Creates a pipe that points to itself. Each file descriptor in fd[] coincides with input (fd[0]) and output (fd[1]). If you write to fd[1], you can read the data on fd[0]. Used mostly with fork().
Return Value: Zero of okay; -1 on error.
Parameters
fd An array of two integers to receive the new file descriptor values.
Possible Errors
EMFILE Too file descriptors already in use by current process.
ENFILE The system's file table is full.
EFAULT The process does not own the memory that fd points to (invalid memory reference).
Examples
int fd[2];
pipe(fd); /* create pipe */