pclose -- Close Pipe I/O To a Process

SYNOPSIS

 #include <stdio.h>

 int pclose(FILE *pipe);
 

DESCRIPTION

pclose closes a pipe connected to a shell command that was opened by popen. The argument pipe is the FILE pointer returned by popen. The pclose function waits for the associated process to terminate.

An appropriate feature test macro (_SASC_POSIX_SOURCE or _POSIX_C_SOURCE) must be defined to make the declaration of pclose in <stdio.h> visible.

RETURN VALUE

pclose returns the exit status of the command. pclose returns - 1 if the stream is not associated with a command called by popen, or if an error occurs closing the pipe.

PORTABILITY

pclose is defined in accordance with POSIX 1003.2.

EXAMPLE

See the example for popen.

RELATED FUNCTIONS

fclose, popen

SEE ALSO


Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.