Many sites describe the function istream :: putback () , which allows you to "return" a character to the input stream so that you can read it again in a subsequent read operation.
What prevents me, however, from calling putback () several times in a row several times in the same thread? Of course, you should check for errors after each operation to see if it succeeded; and yet, I wonder: is there any guarantee that a particular type of stream supports the simultaneous addition of multiple characters?
I can only guess here, but I can imagine that istringstream can return as many characters as the length of a string in a stream; but I'm not sure if this is the same for ifstream .
It's true? How to find out how many characters I can putback () in istream ?
source
share