Share via


_pclose

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at _pclose.

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

Important

This API cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported with /ZW.

Syntax

  
      int _pclose(  
FILE *stream   
);  

Parameters

stream
Return value from the 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. If stream is NULL, _pclose sets errno to EINVAL and returns -1.

For information about these and other error codes, see _doserrno, errno, _sys_errlist, and _sys_nerr.

Remarks

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.

Requirements

Routine Required header
_pclose <stdio.h>

For more compatibility information, see Compatibility.

Libraries

All versions of the C run-time libraries.

.NET Framework Equivalent

Not applicable. To call the standard C function, use PInvoke. For more information, see Platform Invoke Examples.

See Also

Process and Environment Control
_pipe
_popen, _wpopen