Skip to content
This repository has been archived by the owner on Nov 11, 2023. It is now read-only.

Commit

Permalink
readUntilDelimiterAlloc -> streamUntilDelimiter
Browse files Browse the repository at this point in the history
  • Loading branch information
cactusbento authored and alichraghi committed Aug 13, 2023
1 parent 78c6168 commit e8a77f8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/read-input.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ test {
const stdin = std.io.getStdIn();

std.debug.print("input: ", .{});
const input = try stdin.reader().readUntilDelimiterAlloc(allocator, '\n', 1024);
defer allocator.free(input);

std.debug.print("value: {s}\n", .{input});
var input = std.ArrayList(u8).init(allocator);
defer input.deinit();

try stdin.reader().streamUntilDelimiter(input.writer(), '\n', 1024);

std.debug.print("value: {s}\n", .{input.items});
}

0 comments on commit e8a77f8

Please sign in to comment.