The whole content of a file, in memory from context.allocator (free it with free).
Io :: #import "Extensions/Io";
#import "File";
Io.io_run(() {
Io.write_file("/tmp/jacket-io-whole.txt", "contents");
data, error := Io.read_file("/tmp/jacket-io-whole.txt");
assert(error == .NONE && cast(string) data == "contents");
free(data.data);
});
file_delete("/tmp/jacket-io-whole.txt");Doesn't run in the browser (only on linux, macos).
read_file :: (path: string) -> ([] u8, Io_Error)
Parameters
- path: string
Returns
- [] u8