1 messages · Page 1 of 1 (latest)
I would like to convert:
try stdin.readUntilDelimiter(x, '\n');
to the new syntax:
try stdin.streamUntilDelimiter(x, '\n', 4);
x is an *[5]u8
I tried a couple of things, but I don't know how to fix this(as a newbie) and as this function is recent, there's no documentation about it. I stay in touch if you have questions
var fbs = std.io.fixedBufferStream(x);
while (true) {
defer fbs.reset();
stdin.streamUntilDelimiter(fbs.writer(), '\n', x.len) catch |err| switch (err) {
error.EndOfStream => break,
else => |e| return e,
};
const line: []const u8 = fbs.getWritten();
}