pclose

Closes a pipe to a process.

Format

#include  <stdio.h>

int pclose  (FILE *stream);

Arguments

stream
A pointer to a FILE structure for an open pipe returned by a previous call to the popen function.

Description

This function closes a pipe between the calling program and a shell command to be executed. Use pclose to close any stream you have opened with popen. The pclose function waits for the associated process to end, and then returns the exit status of the command. See the description of waitpid for information on interpreting the return value.

See also popen in this section.

Return Values
Exit status of child. 
-1  Indicates an error. The stream argument is not associated with a popen function. errno is set to one of the following:

  • ECHILD - cannot obtain the status of the child process.
 


Previous Page | Next Page | Table of Contents | Index