int pipe(int fd) - creates a pipe and returns two file descriptors, fd, fd. fd is opened for reading, fd for writing.
pipe() returns 0 on success, -1 on failure and sets errno accordingly.
The standard programming model is that after the pipe has been set up, two (or more) cooperative processes will be created by a fork and data will be passed using read() and write().
Pipes opened with pipe() should be closed with close(int fd).
Example: Parent writes to a child
An example of piping in a C program is plot.c and subroutines and is detailed in Appendix .