io
io
I/O builtin namespace.
Runtime support: native runtimes.
Import
use io;
Functions
| Function | Description |
|---|---|
open | Opens a file handle for runtime I/O. |
popen | Starts a child process and returns a process-backed handle. |
read_all | Reads all remaining text from an I/O handle. |
read_line | Reads a single line of text from an I/O handle. |
write | Writes text to an I/O handle. |
flush | Flushes buffered output for an I/O handle. |
close | Closes an I/O handle. |
exists | Returns 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.