Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4 |
both | POSIX(ON) |
#define _XOPEN_SOURCE
#include <stdio.h>
int pclose(FILE *stream);
In any case, pclose() will not return before the child process created by popen() has terminated.
If the shell command cannot be executed, the child termination status returned by pclose() will be as if the shell command terminated using exit(127) or _exit(127).
The pclose() function will not affect the termination status of any child of the calling process other than the one created by popen() for the associated stream.
If the argument stream to pclose() is not a pointer to a stream created by popen(), the termination status returned will be -1.
Threading Behavior: The pclose() function can be executed from any thread within the parent process.
If successful, pclose() returns the termination status of the shell command.