aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--std/io.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/std/io.zig b/std/io.zig
index 2f0305b43f..1054e002f0 100644
--- a/std/io.zig
+++ b/std/io.zig
@@ -419,6 +419,19 @@ pub const InStream = struct {
}
}
+ pub fn readLine(is: &InStream, buf: &Buffer) -> %void {
+ %return buf.resize(0);
+
+ while (true) {
+ var byte: u8 = %return is.readByte();
+ %return buf.appendByte(byte);
+
+ if (buf.endsWith(os.line_sep)) {
+ break;
+ }
+ }
+ }
+
pub fn isTty(self: &InStream) -> %bool {
if (is_posix) {
if (builtin.link_libc) {