If your goal is to read unformatted character data from the stream, you could use std::istreambuf_iterator
instead, without needing to change any format flags of the stream.
std::istreambuf_iterator<char> iter(std::cin), iend;
for(int i=0;i<maxBufferSize;++i)
...