file_pwrite
host callCapy
function file_pwrite(handle : u64, offset : u64, data : string) u64
Description
file_pwrite writes text at an absolute byte offset. It does not change the handle position.
Parameters
handle : writable handle returned by file_open
offset : absolute byte offset
data : text to write
Return Values
The number of bytes written.
Example
Capy
var handle := file_open("/tmp/doc-pwrite.txt", "w")
file_write(handle, "hello world")
file_close(handle)
var editor := file_open("/tmp/doc-pwrite.txt", "r+")
file_pwrite(editor, u64(6), "earth")
file_close(editor)
print(file_get_contents("/tmp/doc-pwrite.txt"), "\n")