Reads from the STDOUT stream of a previously run child process.
StdoutRead ( process_id [, peek = false [, binary = false]] )
| process_id | The process ID of a child process, as returned by a previous call to Run. |
| peek | [optional] If true the function does not remove the read characters from the stream. |
| binary | [optional] If true the function reads the data as binary instead of text (default is text). |
| Success: | Returns the data read. @extended contains the number of bytes read. |
| Failure: | Sets @error to non-zero if EOF is reached, STDOUT was not redirected for the process or other error. |
; Demonstrates StdoutRead()
#include <Constants.au3>
Local $foo = Run(@ComSpec & " /c dir foo.bar", @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
Local $line
While 1
$line = StdoutRead($foo)
If @error Then ExitLoop
MsgBox(0, "STDOUT read:", $line)
WEnd
While 1
$line = StderrRead($foo)
If @error Then ExitLoop
MsgBox(0, "STDERR read:", $line)
WEnd
MsgBox(0, "Debug", "Exiting...")