Skip to main content
gamedev.net
🔒 Locked

Simple input question

Started by Kelendil Nov 14, 2000 at 1:48 PM 0 replies 500+ views
Original Post
Kelendil
Kelendil
My problem resides in using both getch() (from conio.h) and cin.getline (from iostream) in a console based program. If i call getch, my next call to getline will "include" the char typed in the call to getch.....ie: #include #include using namespace std; void main() { char choice; char *tmp_str; choice = getch(); cout << "Enter name : "; cin.seekg(1); cin.getline(tmp_str,80,''\n''); } Let''s say i enter ''a'' for my call to getch() , the cout will display : Enter name : a How can i clear the cin''s "buffer" or stream or whatever?? Thanks in advance....

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.