io

io

I/O builtin namespace.

Runtime support: native runtimes.

Import

use io;

Functions

FunctionDescription
openOpens a file handle for runtime I/O.
popenStarts a child process and returns a process-backed handle.
read_allReads all remaining text from an I/O handle.
read_lineReads a single line of text from an I/O handle.
writeWrites text to an I/O handle.
flushFlushes buffered output for an I/O handle.
closeCloses an I/O handle.
existsReturns whether a file system path exists.

Function details

open

fn open(path: string, mode: string) -> int

Opens a file handle for runtime I/O.

popen

fn popen(command: string, mode: string) -> int

Starts a child process and returns a process-backed handle.

read_all

fn read_all(handle_id: int) -> string

Reads all remaining text from an I/O handle.

read_line

fn read_line(handle_id: int) -> string

Reads a single line of text from an I/O handle.

write

fn write(handle_id: int, text: string) -> int

Writes text to an I/O handle.

flush

fn flush(handle_id: int) -> bool

Flushes buffered output for an I/O handle.

close

fn close(handle_id: int) -> bool

Closes an I/O handle.

exists

fn exists(path: string) -> bool

Returns whether a file system path exists.