Io module

open_file

procedureextensionexperimentalSource

Opens path. Close the file with close.

Example
Io :: #import "Extensions/Io";
#import "File";

Io.io_run(() {
    file, error := Io.open_file("/tmp/jacket-io-open.txt", .WRITE);
    assert(error == .NONE);
    Io.write(*file, "hello");
    Io.close(*file);

    _, error = Io.open_file("/tmp/jacket-io-missing/none.txt");
    assert(error == .NOT_FOUND);
});
file_delete("/tmp/jacket-io-open.txt");

Doesn't run in the browser (only on linux, macos).

open_file :: (path: string, mode := File_Mode.READ) -> (Io_File, Io_Error)

Parameters

path: string
mode := File_Mode.READ

Returns

See also