Skip to content

ReadProcessStream

Narta Xaymar Dirks edited this page Dec 3, 2026 · 1 revision

ReadProcessStream BlitzLLVM

ReadProcessStream:Int32 process:Int32, name:String
Parameter Mode Type Default Description
process In Int32 required The stream that CreateProcess returned.
name In String required std:out or std:err.

Returns: A stream to read from, or 0 for std:err of a program started without BB_PROCESS_ERRORS.

Description

BlitzLLVM This command does not exist in the original Blitz products. BlitzLLVM adds it.

Gives a stream to read what a program started with CreateProcess writes: std:out for its standard output, std:err for its standard error. This is a BlitzLLVM extension.

  • std:err only exists for a program started with BB_PROCESS_ERRORS (from Include "<process.bb>"). Without the flag its errors come out with its output, and this gives 0 for std:err.
  • The names work in any case. Any other name is a runtime error; the program's input is written with WriteProcessStream.
  • It works like the stream of CreateProcess: ReadAvail never waits, reading gives what is there and only waits while nothing has come yet, and Eof turns 1 once the program closed its end or ended.
  • Every call gives a new stream on the same pipe. The pipe stays open until the last stream on it is closed with CloseFile, the one of CreateProcess included, so the program's own stream can be closed first. Only that stream works with ProcessRunning and the other commands that ask about the program.

Examples

Include "<process.bb>"
server = CreateProcess("StrandedII -server", BB_PROCESS_ERRORS)
log = ReadProcessStream(server, "std:out")
errors = ReadProcessStream(server, "std:err")
While ProcessRunning(server)
	If ReadAvail(log) > 0 Then DebugLog "server: " + ReadLine$(log)
	If ReadAvail(errors) > 0 Then DebugLog "server error: " + ReadLine$(errors)
	Delay 10
Wend

Related Commands

CreateProcess BlitzPlus, KillProcess BlitzLLVM, ProcessExitCode BlitzLLVM, ProcessID BlitzLLVM, ProcessRunning BlitzLLVM, WaitProcess BlitzLLVM, WriteProcessStream BlitzLLVM

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally