On Sat, 2014-02-08 at 17:23 -0800, Sean McArthur wrote:
> let in = readln!() ?
>
> macro_rules! readln(
> () => ({
> let mut stdin
> = ::std::io::BufferedReader::new(::std::io::stdin());
> stdin.read_line().unwrap()
> })
> )
> Unless I read the source incorrectly that won't work if the input is not line buffered. The filling of the buffer can exceed the length of line - it can be as large as 64ki. You then read a line and then discard all of the buffered data on exit. In many circumstances if might work as by default stdin is line buffered (at least in C) but the program might start misbehave when it would be switched from terminal input to pipe input.
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
