Lastly I did a lot of work to implement my own stream class in c++. The work is almost done, but there is one last thing...
You see I discovered in C++ input and output streams uses an internal std::streambuf class that is doing the dirty job of actual writing/reading the contents. My streambuf class is operating on files and during this sometimes it may enter a state where it is impossible to do any writing/reading (for example the requested file is not existing).
My problem is, when such that happen, I want to set my streambuf into a bad state. But I discovered that std::streambuf hasn't got setstate
method. Only istream and ostream classes have it. But, as I said before, my streambuf is contained inside those classes.
So, how can I inform classes that have got my streambuf that I entered a bad state?