Capy-Bearer Documentation

file_open

host call

Capy

function file_open(path : string, mode : string) u64

Description

file_open opens a file for incremental access. Use the handle with file_read, file_write, file_seek, and file_close.

Parameters

path : path of the file to open

mode : access mode, such as "r", "w", "a", or "r+"

Return Values

A file handle, or u64(0) when Capy cannot open the file.

Example

Capy

var handle := file_open("/tmp/doc-open.txt", "w")
file_write(handle, "streamed")
file_close(handle)
print(file_get_contents("/tmp/doc-open.txt"), "\n")