Help needed with keyboard input and console output 
Author Message
 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?



Sat, 17 Apr 2004 07:06:14 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. need help on direct keyboard input

2. input, output, input/output parameters?????

3. Keyboard input help: replacement for getch() - windows.h help

4. Need to know whether the focus window will ignore keyboard input

5. Help with keyboard input

6. Help! Checking for keyboard input in multitasking environment

7. Help ! Non Blocking Keyboard Input for Unix

8. Newbie help with keyboard input

9. keyboard input help

10. help: keyboard input

11. Newbie help with keyboard input

12. input/output filename, help!!!!!

 

 
Powered by phpBB® Forum Software