.TH pclose() "" "" "STDIO Function (libc)"
.PC "Close a pipe"
.B "#include <stdio.h>"
\fBint pclose(\fIfp\^\fB)\fR
\fBFILE *\fIfp\^\fB;\fR
.PP
.B pclose()
closes the pipe pointed to by
.IR fp ,
which must have been opened by the function
.BR popen() .
.PP
.B pclose()
awaits the completion of the child process and performs other cleanup.
It returns the value from a
.B WAIT
done on the child process.
This value includes information in addition to the ``simple''
exit value of the child process.
.SH Example
For an example of this function, see the Lexicon entry for
.BR popen .
.SH Files
.B <stdio.h>
.SH "See Also"
.Xr "fclose()," fclose
.Xr "fopen()," fopen
.Xr "libc," libc
.Xr "pipe()," pipe.s
.Xr "popen()," popen
.Xr "sh," sh
.Xr "system()," system
.Xr "wait()" wait.s
.SH Diagnostics
.B pclose()
returns \-1 if
.I fp
had not been created by a call to
.BR popen() .
Otherwise,
.B pclose()
returns the exit status of the
.IR command ,
in the format described in the entry for
.BR wait() :
exit status in the high byte, signal information in the low byte.
