code:
const file = try std.fs.cwd().openFile(“day1.txt”, .{ .read = true });
error msg:
error: no field named ‘read’ in struct ‘fs.File.OpenFlags’
Any help appreciated. using version 0.13.0
You need the mode
field which is an enum.
const file = try std.fs.cwd().openFile("day1.txt", .{ .mode = .read_only });
Remember to check the std library docs, It’s very helpful.
2 Likes
many thanks