1 .\" @(#)popen.3 6.1 (Berkeley) 5/15/85
3 .TH POPEN 3 "May 15, 1985"
6 popen, pclose \- initiate I/O to/from a process
12 FILE *popen(const char *command, const char *type)
13 int pclose(FILE *stream)
17 are pointers to null-terminated strings containing respectively a
18 shell command line and an I/O mode, either "r" for reading or "w" for
19 writing. It creates a pipe between the calling process and
20 the command to be executed. The value returned is a stream pointer that
21 can be used (as appropriate) to write to the standard input
22 of the command or read from its standard output.
28 which waits for the associated process to terminate
29 and returns the exit status of the command.
31 Because open files are shared, a type "r" command may be used as an input
32 filter, and a type "w" as an output filter.
42 returns a null pointer if files or processes cannot be created, or the shell
45 Buffered reading before opening an input filter
46 may leave the standard input of that filter mispositioned.
47 Similar problems with an output filter may be
48 forestalled by careful buffer flushing, for instance, with