|
From: Nicholas O. R. <exc...@mi...> - 2004-05-22 03:14:27
|
I've never actually found a function that would tell whether or not there is another character on the buffer... you might be able to rig up something with the functions in wincon.h or conio.h; I've never tried. However, you can use "cin.peek()" to read the next character on the input buffer without extracting it from the buffer. You can also extract a character with "cin.get()" and then put it back onto the buffer with "cin.putback()" or "cin.unget()". You could probably also use "cin.sync()" instead of "cin.ignore()" -- it doesn't require that any characters be on the buffer before it sweeps them all away, so you don't have to worry about it eating input meant for a "cin.getline()". Nicholas |