I'm trying to print on the same line because I want the input question to be inline like 'enter something: input goes here'. Similiar to python's input("input: ")
.
If I try to do it, the print!
text doesnt display, it displays after I've pressed enter.
I've tried flushing the buffer.
print!("enter some thing: ");
let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("Failed to read line");
println!("{}", input);
Above code output will be:
hello
enter some thing: hello
Why does that happen?