I am trying to implement a stream to decode base64 on-the-fly from another stream. To do this I created a new class derived from std::basic_streambuf<char, std::char_traits<char> > and everything seems to work except one thing.
In the onderflow() function I have to return the first byte of the buffer with the decoded payload. But the decoded payload could contain the byte 0xff. If I return this character, the stream assumes the end of the stream because 0xff = EOF.
Most of the examples in the web use this to change the value, if it is equal to EOF.