Was having a look at Readers and BufferedReaders, simplest example of open a file, read its contents in limited steps to print it and not potentially run out of memory in the process.
So i found
var file = try std.fs.cwd().openFile(
"ZigExamples/file-io/lorem.txt", .{}
);
defer file.close();
var buffered = std.io.bufferedReader(file.reader());
var bufreader = buffered.reader();
var buffer: [1000]u8 = undefined;
@memset(buffer[0..], 0);
_ = try bufreader.readUntilDelimiterOrEof(
buffer[0..], '\n'
);
try stdout.print("{s}\n", .{buffer});
from 13 Filesystem and Input/Output (IO) – Introduction to Zig
And: whats the point of buffered reader if we still need to create another buffer and thats what we use?
Im clearly missing some stuff.