函数参考


StdioClose

关闭前面运行(run)的进程的STDIO流的所有资源.

StdioClose ( 进程ID )

参数

进程ID 子进程的进程ID, 由上一次调用运行(run)返回.

返回值

成功: 返回值为非零.
失败: 返回值为 0 ,如果进程没有 STDIO 流或者已经被关闭.

注意/说明

This function closes all handles and releases all resources related to STDIO. It will no longer be possible to read the STDIO data from the process. Any pending data will be lost.

相关

StdoutRead, StderrRead, StdinWrite, Run, RunAs

示例/演示


; Demonstrates StdioClose()
#include <Constants.au3>

Local $pid = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
StdioClose($pid)

; No data will be read because we closed all the streams we would read from.
Local $line
While 1
    $line = StdoutRead($pid)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
WEnd

While 1
    $line = StderrRead($pid)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
WEnd

MsgBox(0, "Debug", "Exiting...")