Closes a pipe to a process.
Standard C Library (libc.a)
#include <stdio.h>
int pclose ( Stream)
FILE *Stream;
The pclose subroutine closes a pipe between the calling program and a shell command to be executed. Use the pclose subroutine to close any stream you opened with the popen subroutine. The pclose subroutine waits for the associated process to end, and then returns the exit status of the command.
Avoid problems with an output filter by flushing the buffer with the fflush subroutine.
Item | Description |
---|---|
Stream | Specifies the FILE pointer of an opened pipe. |
The pclose subroutine returns a value of -1 if the Stream parameter is not associated with a popen command or if the status of the child process could not be obtained. Otherwise, the value of the termination status of the command language interpreter is returned; this will be 127 if the command language interpreter cannot be executed.
If the application has:
one of these calls caused the termination status to be unavailable to the pclose subroutine, a value of -1 is returned and the errno global variable is set to ECHILD.