ReadProgramData()

Syntax

Result = ReadProgramData(Program, *Buffer, size)
Description
Reads data from the given programs output (stdout) and puts it in the specified buffer (a memory area will be reserved with AllocateMemory()).

The program must have been started with RunProgram() and the #PB_Program_Read flag.

The command reads up to 'size' bytes, but also less if not that much is available (but it will not return zero bytes because it always waits for some data to read). Check the returnvalue to know how much data was read.

Note: This command waits until there is data to read from the program. To prevent this wait, AvailableProgramOutput() can be used first to check if there is something to read.

Return value

Returns the number of bytes that were actually read.

Supported OS

All

<- ProgramRunning() - Process Index - ReadProgramError() ->