Import with #import "std/file".

ReadEntireFile :: (path: string) -> (string, bool)

The whole file's bytes as text, and whether it could be read.

ReadFileInto :: (path: string, bytes: *Vec(u8)) -> bool

Appends the whole file's bytes to BYTES, which the caller owns and which is freed with the caller's local; false when the file cannot be read, and then BYTES may hold part of it. Read files that are read again and again this way: native C keeps the text ReadEntireFile returns for the life of the program.

WriteEntireFile :: (path: string, text: string) -> bool

Replace the file at PATH with TEXT; false when it cannot be written whole.

Source ↗ · All modules