After binding cin to istream_iterator and reading its I don't have whitespaces:
iter = istream_iterator<char>(std::cin);
istream_iterator<char> iend;
for(int i=0;i<maxBufferSize;++i)
{
if(iter==iend)
return STREAMBUFFER_EOF;
c = *iter;
buffer += c;
iter++;
}
if(iter==iend)
return STREAMBUFFER_EOF;
return STREAMBUFFER_OK;
Is there way to configure it to not ignore whitespaces?
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)
...