Accessing the content of the stream using str()
will return you then entire character sequence in the buffer. If you need to access the unread subsequence of the stream, you can use substr()
with tellg()
:
std::string unread = is.str().substr(is.tellg());
std::cout << unread; // "a0101"