Result = ReadProgramData(Program, *Buffer, Size)
Reads data from the given programs output (stdout) and puts it in the specified buffer. This function waits until there is data available to read from the program. To prevent this wait, AvailableProgramOutput() may be used first to check if there is something to read.


Program The program to use. It must have been started before with RunProgram() and the #PB_Program_Read flag.
*Buffer The memory buffer to read the data into. A memory buffer can be created for example with AllocateMemory().
Size The size to read, in bytes. The buffer should be large enough to handle this size.

Return value

The number of bytes actually read.


The function 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).

However, the function remains blocked indefinitely if the program requests the intervention of the user. For example, return a yes / no choice to the program to continue.

See Also


Supported OS


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