The Stdio interface

Stdio provides streams for standard input, standard output, and standard error. These streams correspond to file handles returned by the GetStandardFileHandles procedure in the Process interface. standard I/O streams

INTERFACE Stdio;

IMPORT Rd, Wr;

VAR
  stdin: Rd.T;
  stdout: Wr.T;
  stderr: Wr.T;
  bufferedStderr: Wr.T;

END Stdio.

The initialization of these streams depends on the underlying operating system.

If the standard error stream is directed to a terminal, it will be unbuffered, so that explicit Wr.Flush calls are unnecessary for interactive programs. A buffered version of the standard error stream is also provided, but programs should not use both stderr and bufferedStderr.

If the streams are directed to or from random-access files, they will be seekable.

It is possible that stderr is equal to stdout. Therefore, programs that perform seek operations on stdout should take care not to destroy output data when writing error messages.