Read from stdin, write to stdout

This commit is contained in:
Dan Davison 2019-06-23 18:06:47 -04:00
parent 5a4361fa03
commit 4404c17c22

View File

@ -1,3 +1,10 @@
use std::io::{self, Read, Write};
fn main() {
println!("Hello, world!");
let mut stdin = io::stdin();
let mut stdout = io::stdout();
let mut buf = String::new();
stdin.read_to_string(&mut buf);
stdout.write_all(buf.as_bytes());
stdout.flush();
}