
Help needed with keyboard input and console output
If you've determined that cin.getline stopped before reaching a newline
character, you can skip the rest of the line with
cin.ignore(INT_MAX, '\n');
By the way, why don't you just use
string line;
geline(cin, line);
and stop worrying about fixed size buffers? Do you expect the user to enter
huge strings of which you only need first 15 characters?
--
With best wishes,
Igor Tandetnik
"For every complex problem, there is a solution that is simple, neat, and
wrong." H.L. Mencken
Quote:
> How can i reset the keyboard buffer?
> Like when i do getch(), and then cin.getline, the character i pressed
> for getch() appears on the input line.
> Also when i do things like: cin.getline(buffer, 16);
> cin.getline(buffer2, 16), cin.getline(buffer3, 16), if i type more than 16
> chars for the first line, the chars that are over 16 go into the next
cins.
> And is there a good alternative for cin?
> How can i change the text/background colours in a console app?