Capy-Bearer Documentation

file_pread

host call

Capy

function file_pread(handle : u64, offset : u64, length : u64) string

Description

file_pread reads at an absolute byte offset. It accepts a maximum length of 16 MiB. It does not change the handle position.

Parameters

handle : readable handle returned by file_open

offset : absolute byte offset

length : maximum number of bytes to read

Return Values

A string with up to length bytes.

Example

Capy

var writer := file_open("/tmp/doc-pread.txt", "w")
file_write(writer, "hello world")
file_close(writer)
var reader := file_open("/tmp/doc-pread.txt", "r")
print(file_pread(reader, u64(6), u64(5)), "\n")
file_close(reader)