Skip to main content

io

include "io";

Print text to the console, and read or write the program's standard input, output and error streams.

Types​

stream​

Native object

read​

fn read(buffer buffer, int buffer_offset, int count) -> int

Reads up to count bytes into buffer at buffer_offset; 0 at end of input.

read_within​

fn read_within(buffer buffer, int buffer_offset, int count, float seconds) -> int

Like read, but fails with code -331 if the stream is not readable within seconds.

write​

fn write(buffer buffer, int buffer_offset, int count) -> int

Writes up to count bytes from buffer at buffer_offset and returns how many were written.

Functions​

stdin infallible​

infallible fn stdin() -> stream

The process's standard input. The process owns it; do not close it.

stdout infallible​

infallible fn stdout() -> stream

The process's standard output. The process owns it; do not close it.

stderr infallible​

infallible fn stderr() -> stream

The process's standard error. The process owns it; do not close it.

infallible fn print(string text)

Writes text to standard output and flushes it; output failures are ignored.

println infallible​

infallible fn println(string text)

Writes text and a newline to standard output as one write and flushes it; output failures are ignored.