#How to read a binary file to memory?
1 messages · Page 1 of 1 (latest)
got it
const file = try std.fs.cwd().openFile("testfile", .{});
defer file.close();
const allocator = std.heap.page_allocator;
const file_size = try file.getEndPos();
const buffer = try allocator.alloc(u8, file_size);
_ = try file.readAll(buffer);