The position of the next read or write, in bytes from the start of the file, and whether it could be read.
A closed file gives (0, false).
file_current_position :: (f: File) -> (s64, bool)
Parameters
- f: File
Returns
- s64
- bool
#import "Extensions/Environment";
base := environment_variable("TMPDIR");
if base == "" base = environment_variable("TEMP");
if base == "" base = "/tmp";
path := tprint("%/jai-doc-position.bin", base);
defer file_delete(path);
assert(write_entire_file(path, "abcdef"));
file, ok := file_open(path);
assert(ok);
defer file_close(*file);
buffer: [2] u8;
file_read(file, buffer.data, 2);
position, position_ok := file_current_position(file);
assert(position_ok && position == 2);Doesn't run in the browser (only on windows).