I'm writing an adapter between different libraries in C++20. I reached a part where I get a std::istream from one library and pass it to the second library, which also takes std::istream. The problem is the second library requires a stream which ends with one specific character (let's say it is a full stop), and I'm 100% sure the first library gives me a stream without this character.
I's thinking about playing with stream buffers. I once made a custom stream buffer and it worked, but now I barely remember how I did it. Except this nothing comes to my mind.
In other words: how to force/modify/wrap-around/what-have-you an istream to produce exactly one extra character before it ends?
PS: I'm also constrained to use only C++'s Standard Library.
Thanks to @Sam Varshavchik I got an solution:
Now I have to just create a new instance of
ExtendedStreamclass and pass it to the second library.