Skip to content

Instantly share code, notes, and snippets.

@mikdusan
Created January 21, 2020 19:43
Show Gist options
  • Save mikdusan/b73d013e8ec25c29c61d77bb9fc78a50 to your computer and use it in GitHub Desktop.
Save mikdusan/b73d013e8ec25c29c61d77bb9fc78a50 to your computer and use it in GitHub Desktop.
const std = @import("std");
pub fn main() !void {
var arena_impl = std.heap.ArenaAllocator.init(std.heap.page_allocator);
const arena = &arena_impl.allocator;
defer arena_impl.deinit();
var buf = try std.Buffer.init(arena, "");
var in_impl = std.io.getStdIn().inStream();
var in = &in_impl.stream;
const bytes = try std.io.readLineFrom(in, &buf);
std.debug.warn("read: {}\n", .{bytes});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment