File module

File

structSource

An open file. It holds the operating system's HANDLE and nothing else, so a copy of a File is the same open file, not a second one. Get one from file_open, and give it back with file_close exactly once.

A zero File is not open: is_valid is false for it and every procedure fails on it. Reads and writes go straight to the system without a buffer of ours in between.

Example
file, ok := file_open("jai-doc-no-such-file.txt");
assert(!ok && !is_valid(file));

Doesn't run in the browser (only on windows).

Fields

handle: W.HANDLE

See also