*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: popen | Section: 3 | Source: Digital UNIX | File: popen.3.gz
popen(3) Library Functions Manual popen(3) NAME popen - Initiates a pipe to a process LIBRARY Standard C Library (libc.so, libc.a) SYNOPSIS #include <stdio.h> FILE *popen ( const char *command, const char *type ); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: popen(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Points to a null-terminated string containing a shell command line. Points to a null-terminated string containing an I/O mode. DESCRIPTION The popen() function creates a pipe between the calling program and a shell command to be executed. It returns a pointer to a FILE structure for the stream. If the type parameter is the value r, the calling program can read from the standard output of the command by reading from the returned file stream. If the type parameter is the value w, the calling program can write to the standard input of the command by writing to the returned file stream. Because open files are shared, a type r command can be used as an input filter and a type w command as an output filter. NOTES Programs using the popen() function to invoke an output filter should beware of possible deadlock caused by output data remaining in the pro- gram's buffer. This can be avoided by either using the setbuf() func- tion to ensure that the output stream is unbuffered, or by using the fflush() function to ensure that all buffered data is flushed before calling the pclose() function. If the original processes and the process started with the popen() function concurrently read or write a common file, neither should use buffered I/O. If they do, the results are unpredictable. RETURN VALUES Upon successful completion, the popen() function returns a pointer to the FILE structure for the opened stream. In case of error because files or processes could not be created, the popen() function returns a null pointer. RELATED INFORMATION Functions: exec(2), fork(2), fclose(3), fopen(3), pclose(3), pipe(2), setbuf(3) Standards: standards(5) delim off popen(3)

Navigation Options