io
library
[include "std:io"]
#include "std:io"
import * as io from 'std:io';
I/O functions for reading and writing data.
Structs
File
A file is a complex type that represents a file on the file system. It contains a pointer to the file, the filename, the mode in which the file was opened, the size of the file, and functions to read, write, and close the file.
Reading the file returns a Stream
object that can be used to read the file line by line. Writing to the file writes the given string to the file. Closing the file releases the resources associated with the file.
[defstruct File
[file void*]
[filename String]
[mode String]
[size i32]
[read [File] -> Stream]
[write [File] -> bool]
[close [File] -> void]]
struct File {
void* file;
String filename;
String mode;
i32 size;
Stream read();
bool write();
void close();
}
struct File {
file: void*;
filename: String;
mode: String;
size: i32;
fn read() -> Stream;
fn write() -> bool;
fn close() -> void;
}
Stream
[defstruct Stream
[stream void*]
[read [Stream] -> String]
[write [Stream, String] -> bool]
[close [Stream] -> void]]
struct Stream {
void* stream;
String read();
bool write(String);
void close();
}
struct Stream {
stream: void*;
fn read() -> String;
fn write(String) -> bool;
fn close() -> void;
}