std1.0.0-beta-7 SafeC docs

Module io_file

#include <std/io_file.h> source

File I/O (C11 <stdio.h> wrappers) Handles are '&File' references to an opaque type (the C FILE underneath is never exposed); File::open returns '?&File', null on failure. Operations are methods on the handle: f.read(buf), f.write(buf) (byte slices), f.seek(off, whence), f.close(), ... File conforms to io_traits.h's SeekableStream (Reader, Writer, Seekable) and Flusher, so read_exact, write_all, copy_stream, stream_size and io_buf.h's BufReader / BufWriter work on it.

Structs

File

Functions

file_openKept for std/ml until its refactor moves to the methods above; forward to File::open() / f.close() / f.read() / f.write() / f.seek() / f.tell() / f.size(). file_read / file_write keep their old unsigned results (an error reads as 0 bytes).
file_closeCloses *f in place (File::open hands out references, not owned values).
file_read
file_write
file_seek
file_tell
file_size