I'm using C++Builder, and am trying to slowly migrate code to using C++ standard library in preference to the Delphi VCL.
The VCL has a streaming architecture based around the TStream
class, and I'm switching to using std::stream
instead. However, in the short term, I still need a way of 'mixing' use of the two stream types.
I can do this using intermediate std::stringstream/TStringStream
objects, but this seems a little inefficient and cumbersome. Does anyone have a better suggestion?
Edit:
TStream provides similar functionality to std::streams, but is not derived from it. You can create different kinds of streams (TFileStream, TMemoryStream, TStringStream) and read/write data to/from them. See the Embarcadero docwiki TStream reference.
Edit:
Example - Imagine I have a std::ostream that I have written some stuff to, and I now want to append a JPEG Image to it using TJPEGImage.SaveToStream(str : TStream). And, I'll want to read it from a std::istream later...