main : boucle pour lire stdin
This commit is contained in:
parent
5b65a4d3e5
commit
9ed1364e0e
1 changed files with 12 additions and 1 deletions
13
src/main.rs
13
src/main.rs
|
@ -1,3 +1,14 @@
|
|||
use std::io::Write;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue