eof
is not set, but neither is good
. The stream is ignoring operations because it's in a failure mode.
I cannot recall what unget
is supposed to do after EOF, but unget
goes right back into failure if I use clear
to allow a retry.
It's usually better to use your own buffer. Putback is a hack.