| author | |
| committer | |
| log | 0f7544cfca63fc5b49790974e6b01097365bb18c |
| tree | 39d9d8ac69e20b940847588f9b656dbc422ebc45 |
| parent | b00b7bd29037f25ee155f07e74fcb5de44918926 |
1 files changed, 13 insertions(+), 0 deletions(-)
std/io.zig+13| ... | ... | @@ -419,6 +419,19 @@ pub const InStream = struct { |
| 419 | 419 | } |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | pub fn readLine(is: &InStream, buf: &Buffer) -> %void { | |
| 423 | %return buf.resize(0); | |
| 424 | ||
| 425 | while (true) { | |
| 426 | var byte: u8 = %return is.readByte(); | |
| 427 | %return buf.appendByte(byte); | |
| 428 | ||
| 429 | if (buf.endsWith(os.line_sep)) { | |
| 430 | break; | |
| 431 | } | |
| 432 | } | |
| 433 | } | |
| 434 | ||
| 422 | 435 | pub fn isTty(self: &InStream) -> %bool { |
| 423 | 436 | if (is_posix) { |
| 424 | 437 | if (builtin.link_libc) { |