pclose()

close pipe stream 

Function


SYNOPSIS

#include <stdio.h>

int pclose(FILE *stream);


DESCRIPTION

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:

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).


PARAMETERS

stream 

Points to stream that is to be closed. Behavior is undefined if this is not a stream returned by popen().


RETURN VALUES

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.


CONFORMANCE

POSIX.1 (1996)


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

MKS Toolkit for Professional Developers
MKS Toolkit for Enterprise Developers
MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
_exit(), exit(), popen(), system(), wait(), waitpid()


MKS Toolkit 9.2 Documentation Build 16.