Skip to content

ReaderUtil::each_byte includes trailing EOF #5056

Closed
@evmar

Description

@evmar
use io::ReaderUtil;

fn main() {
    let stdin = io::stdin();
    for stdin.each_byte() |b| {
        io::println(fmt!("byte '%c' %d", b as char, b));
    }
}
$ echo foo | ./main 
byte 'f' 102
byte 'o' 111
byte 'o' 111
byte '
' 10
byte '?' -1

That last byte shouldn't be included.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions