Answers for "stdin rust"

1

how to read from stdin rust

use std::io;

let mut input = String::new();
match io::stdin().read_line(&mut input) {
    Ok(n) => {
        println!("{} bytes read", n);
        println!("{}", input);
    }
    Err(error) => println!("error: {}", error),
}Run
Posted by: Guest on February-21-2020

Browse Popular Code Answers by Language