popen() -- Formatted Piping
FILE *popen(char *command, char *type) -- opens a pipe for I/O where the command is the process that will be connected to the calling process thus creating the pipe. The type is either "r" - for reading, or "w" for writing.
popen() returns is a stream pointer or NULL for any errors.
A pipe opened by popen() should always be closed by pclose(FILE *stream).
We use fprintf() and fscanf() to communicate with the pipe's stream.
pipe() -- Low level Piping
int pipe(int fd[2]) -- creates a pipe and returns two file descriptors, fd[0], fd[1]. fd[0] is opened for reading, fd[1] 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).