source: trunk/minix/man/man3/popen.3@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 1.4 KB
Line 
1.\" @(#)popen.3 6.1 (Berkeley) 5/15/85
2.\"
3.TH POPEN 3 "May 15, 1985"
4.AT 3
5.SH NAME
6popen, pclose \- initiate I/O to/from a process
7.SH SYNOPSIS
8.nf
9.ft B
10#include <stdio.h>
11
12FILE *popen(const char *command, const char *type)
13int pclose(FILE *stream)
14.SH DESCRIPTION
15The arguments to
16.B popen
17are pointers to null-terminated strings containing respectively a
18shell command line and an I/O mode, either "r" for reading or "w" for
19writing. It creates a pipe between the calling process and
20the command to be executed. The value returned is a stream pointer that
21can be used (as appropriate) to write to the standard input
22of the command or read from its standard output.
23.PP
24A stream opened by
25.B popen
26should be closed by
27.BR pclose ,
28which waits for the associated process to terminate
29and returns the exit status of the command.
30.PP
31Because open files are shared, a type "r" command may be used as an input
32filter, and a type "w" as an output filter.
33.SH "SEE ALSO"
34.BR pipe (2),
35.BR fopen (3),
36.BR fclose (3),
37.BR system (3),
38.BR wait (2),
39.BR sh (1).
40.SH DIAGNOSTICS
41.B Popen
42returns a null pointer if files or processes cannot be created, or the shell
43cannot be accessed.
44.SH BUGS
45Buffered reading before opening an input filter
46may leave the standard input of that filter mispositioned.
47Similar problems with an output filter may be
48forestalled by careful buffer flushing, for instance, with
49.BR fflush ,
50see
51.BR fclose (3).
Note: See TracBrowser for help on using the repository browser.