I want to know how many characters std::cin::ungetc accepts. Is it the same as in C (thus portably 1, see below)?
Related SO Post "ungetc: number of bytes of pushback".
I want to know how many characters std::cin::ungetc accepts. Is it the same as in C (thus portably 1, see below)?
Related SO Post "ungetc: number of bytes of pushback".
Don't forget, one form of input stream is the keyboard, which isn't required to be buffered. When it's not, there's no backing store except what the stream itself provides. So the choice is to provide one character of pushback, which handles almost all situations, or provide more and waste space most of the time. Just as in C, you're guaranteed one character.