Hello, I'm trying to make a kind of complicated overloaded input operator in C++, and I need to look ahead a couple of characters on the input stream, and not remove them from the stream until I know they're both the characters I want.
I use cin.peek() to see if the first character is what I want, and if it is, I use cin.get(). Then I use cin.peek() again for the second character to see if it's what I want, and if it is, I use cin.get() again. But if the second character isn't the one I want, I don't take it off the input stream, and I put the first one back on with cin.unget().
My problem is that if I use cin.unget() after I use cin.peek(), my program prompts the user for more input, even if there is lots more stuff waiting on the stream. I don't see why cin.unget() should prompt the user for input. It only does this after cin.peek().
My operating system is Windows XP, and I'm using the Dev-C++ development enviroment.
Thanks in advance for any help you can give me.