read from std in

This commit is contained in:
Julian Graf 2022-11-17 12:01:45 +01:00
parent 9a1997ad55
commit a6c03b9857

View File

@ -7,4 +7,17 @@ fn main() {
} else { } else {
println!("Couldn't connect to server..."); println!("Couldn't connect to server...");
} }
loop {
let mut buffer = String::new();
match std::io::stdin().read_line(&mut buffer){
Ok(_n) => {
println!("{}", buffer);
}
Err(_error) =>{
println!("Fehlerhafte Eingabe!");
break;
}
}
}
} // the stream is closed here } // the stream is closed here