Next: pipe() - Low level Piping Up: Piping in a C program Previous: Piping in a C program

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.


Dave.Marshall@cm.cf.ac.uk
Wed Sep 14 10:06:31 BST 1994