#How to convert `stdin.readUntilDelimiter(x, "\n")` to non-deprecated equivalent

1 messages · Page 1 of 1 (latest)

zealous yoke
#

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

strange skiff
#
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();
}