main : boucle pour lire stdin

This commit is contained in:
Ahurac 2024-04-09 09:46:03 +02:00
parent 5b65a4d3e5
commit 9ed1364e0e

View file

@ -1,3 +1,14 @@
use std::io::Write;
fn main() { fn main() {
println!("Hello, world!"); let mut user_input = String::new();
let mut bytes_read = 1;
while bytes_read != 0 {
print!("$ ");
std::io::stdout().flush().unwrap();
bytes_read = std::io::stdin()
.read_line(&mut user_input)
.expect("error reading user input");
}
} }