Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer


Waits for new command processor and closes stream on associated pipe.

int _pclose(
   FILE *stream 


Return value from previous call to _popen.

Return Value

Returns the exit status of the terminating command processor, or –1 if an error occurs. The format of the return value is the same as that for _cwait, except the low-order and high-order bytes are swapped.


The _pclose function looks up the process ID of the command processor (CMD.EXE) started by the associated _popen call, executes a _cwait call on the new command processor, and closes the stream on the associated pipe.


Routine Required header Compatibility
_pclose <stdio.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.


All versions of the C run-time libraries.

See Also

Process and Environment Control Routines | _pipe | _popen | Run-Time Routines and .NET Framework Equivalents

© 2016 Microsoft