Capy-Bearer Documentation

file_fsync

host call

Capy

function file_fsync(handle : u64) bool

Description

file_fsync flushes pending writes for a handle. Call it before file_close when the file system must receive the writes first.

Parameters

handle : writable handle returned by file_open

Return Values

true when Capy flushes the handle. Otherwise, it returns false.

Example

Capy

var handle := file_open("/tmp/doc-fsync.txt", "w")
file_write(handle, "durable")
print(file_fsync(handle), "\n")
file_close(handle)

Output

true