Io module

read_at

procedureextensionexperimentalSource

Reads at offset; the file's position does not move.

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

Io.io_run(() {
    Io.write_file("/tmp/jacket-io-at.txt", "0123456789");

    file, _ := Io.open_file("/tmp/jacket-io-at.txt");
    defer Io.close(*file);

    buffer: [3] u8;
    Io.read_at(*file, buffer, 4);
    assert(string.{ 3, buffer.data } == "456");
});
file_delete("/tmp/jacket-io-at.txt");

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

read_at :: (file: *Io_File, buffer: [] u8, offset: s64) -> (s64, Io_Error)

Parameters

file: *Io_File
buffer: [] u8
offset: s64

Returns

s64

See also