how can I create std::ostream
and std::istream
objects to point to a piece of memory I allocated and manage (I don't want the stream to free my memory).
I was looking at using rdbuf()->pubsetbuf()
to modify one of the other streams - say sstringstream
. However I think streambuf used by stringstream
will free the buffer afterwards?
Basically I'm trying to serialize some things to shared memory.
Thanks.