Create a pipe
#include <unistd.h> int pipe( int fildes );
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The pipe() function creates a pipe (an unnamed FIFO) and places a file descriptor for the read end of the pipe in fildes, and a file descriptor for the write end of the pipe in fildes. Their integer values are the two lowest available at the time of the pipe() function call. The O_NONBLOCK flag is cleared for both file descriptors. (You can use fcntl() to set the O_NONBLOCK flag.)
You can write data to file descriptor fildes and read it from file descriptor fildes. If you read from file descriptor fildes, it returns the data written to fildes on a first-in-first-out (FIFO) basis.
The pipe buffer is allocated by the pipe resource manager.
You typically use this function to connect standard utilities acting as filters, passing the write end of the pipe to the data-producing process as its STDOUT_FILENO, and the read end of the pipe to the data-consuming process as its STDIN_FILENO (either via the traditional fork(), dup2(), or exec*, or the more efficient spawn* calls).
If successful, pipe() marks the st_ftime, st_ctime, st_atime and st_mtime fields of the pipe for updating.
errno, fcntl(), nbaconnect(), open(), popen(), read(), write()
pipe in the Utilities Reference