[serialization]-- serialize binary data to a memory buffer?

I saw an example where boost serialized a text archive to a strstream for sending via a socket. I would like to do something similar, but for binary data. Is there a way to do the binary serialization to a memory buffer, and then send it elsewhere? It doesnt seem like strstream and boost::archive::binary_oarchive would mix correctly. I have also seen some discussion regarding a binary_iostreams library, but its doesnt look like that exists yet. thanks Rich

On Oct 16, 2007, at 6:09 PM, Rich Peters wrote:
I saw an example where boost serialized a text archive to a strstream for sending via a socket. I would like to do something similar, but for binary data.
Is there a way to do the binary serialization to a memory buffer, and then send it elsewhere? It doesnt seem like strstream and boost::archive::binary_oarchive would mix correctly. I have also seen some discussion regarding a binary_iostreams library, but its doesnt look like that exists yet.
You can use the Boost IOstreams library to create an iostream using a memory buffer and use that with the binary archives Matthias

investigate which kind of stream buffer stringstream is using.
Re-use that buffer in creating a new archive.
Robert Ramey
"Rich Peters"
participants (3)
-
Matthias Troyer
-
Rich Peters
-
Robert Ramey