HPlogo MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 4  POSIX/iX Library Function Descriptions

pclose

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

Close a pipe.

Syntax

   #include <stdio.h>

   int pclose(FILE *stream);

Parameters

stream

is the pointer for a pipe opened with popen(). If it is not a pointer for a pipe opened with popen(), the result is undefined.

Description

pclose() closes a pipe that was opened with popen(). It then waits for the command on the other end of the pipe to terminate.

Errors

Normally, pclose() returns the termination status of the command at the other end of the pipe. However, if the process calling pclose() has also called wait() or waitpid() with a pid argument less than or equal to zero, or with some non-standard function that makes it impossible for pclose() to determine the termination status, pclose() returns -1 and sets errno to ECHILD.

If popen() was unable to invoke the shell to execute a command, pclose() returns a termination status as if the shell had terminated with exit(127).

pclose() may set errno to one of the following:

ECHILDCAUSEpclose() was unable to determine the child process's status.
 ACTIONNo action is necessary.

See Also

sh(1), popen()

Feedback to webmaster