-lo,
I'm trying to learn C++..
What if I have
cin.getline(buf, 50);
and the user spams 50+n letters before hitting newline? The first 50 go to buf, and the others just stay in the stream? If this is the case, how can I just clear the stream once and for all, ready for next getline?
I tried some things with cin.ignore, but didn't get it to work.
I'm trying to learn C++..
What if I have
cin.getline(buf, 50);
and the user spams 50+n letters before hitting newline? The first 50 go to buf, and the others just stay in the stream? If this is the case, how can I just clear the stream once and for all, ready for next getline?
I tried some things with cin.ignore, but didn't get it to work.