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

@@ -10,14 +10,17 @@ fn main() {

loop {
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);
}
Err(_error) =>{
Err(_error) => {
println!("Fehlerhafte Eingabe!");
break;
}
}
}
} // the stream is closed here
} // the stream is closed here

Loading…
Cancel
Save