#include <stdio.h>
int pclose(FILE *stream);
The pclose() function
closes a stream that was opened by popen(),
waits for the command to terminate, and returns the termination
status of the process that was running the command interpreter.
However, if a call caused the termination status to be
unavailable to pclose(), then pclose()
returns -1 with errno set to ECHILD to report
this situation. This can happen if the application calls one of the following
functions:
- wait()
- waitpid() with the pid argument of
-1 or equal to the process ID of the command interpreter.
In any case, pclose() does not return before the child
process created by popen() terminates.
If some error prevents the command interpreter from executing after the child
process is created, the return value from pclose() is as
if the command language interpreter had terminated using exit(127)
or _exit(127).
- stream
-
Points to stream that is to be closed. Behavior is undefined if this is not a
stream returned by popen().
If successful, pclose()
returns the exit status of the command. On error, it returns
-1 with errno set to one of the following values:
- ECHILD
-
The status of the child could
not be obtained.
POSIX.1 (1996)
MT-Safe.
None.
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
- Functions:
- _exit(), exit(), popen(), system(), wait(), waitpid()
PTC MKS Toolkit 10.5 Documentation Build 40.