Signature
u64 file_write(u64 h, String data)
Parameters
h : handle from file_open() opened for writing
data : bytes to write at the current offset
return value : number of bytes written
Writes data at the handle's current offset and advances the offset. The handle must come from file_open() with a writable mode ("w", "a", or "r+"). Binary-safe: data may contain NUL and other non-text bytes.
Example
u64 h = file_open("/tmp/doc-write.txt", "w");
u64 n = file_write(h, "hello world");
file_close(h);
print(n, " bytes -> ", file_get_contents("/tmp/doc-write.txt"), "\n");
Output
11 bytes -> hello world