Browse Source

Hinzufügen "Beenden mit Strg + D"

Key-exchange
Florian Geiger 2 years ago
parent
commit
29a270a01d
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      src/bin/client.rs

+ 7
- 4
src/bin/client.rs View File



loop { loop {
let mut buffer = String::new(); let mut buffer = String::new();
match std::io::stdin().read_line(&mut buffer){
Ok(_n) => {
match std::io::stdin().read_line(&mut buffer) {
Ok(n) => {
if n == 0 {
break;
}
println!("{}", buffer); println!("{}", buffer);
} }
Err(_error) =>{
Err(_error) => {
println!("Fehlerhafte Eingabe!"); println!("Fehlerhafte Eingabe!");
break; break;
} }
} }
} }
} // the stream is closed here
} // the stream is closed here

Loading…
Cancel
Save