Hello,
I'm new to Rust and come from JS and TS.
Is there a way to ignore the first line that comes with stdin?
Scenario
My program will get a file piped in, and the first line us no use to me.
Hello,
I'm new to Rust and come from JS and TS.
Is there a way to ignore the first line that comes with stdin?
Scenario
My program will get a file piped in, and the first line us no use to me.
But that my code would look like this
let mut dont_need_it = String::new();
let _ = std::io::stdin().read_line(&mut dont_need_it);
let mut stuff_i_need = String::new();
let _ = std::io::stdin().read_line(&mut stuff_i_need);
Correct.
Yes. Because stdin
doesn't implement Iter
trait.
Also you can write:
std::io::stdin().read_line(&mut String::new());
thx
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.