|
Boost Users : |
From: Todd Greer (TGreer_at_[hidden])
Date: 2006-08-04 19:30:41
Anil Krishna wrote:
> In the above code, I am saving the map to a binary file and retrieving
it
> from the file. Instead of that I would want to serialize the data into
a
> char buffer and restore it from the buffer.
Serialize into a std::ostringstream, ship its buffer to the other
receiver, construct a std::istringstream from the received buffer, then
deserialize from the istringstream you just constructed.
Read up on std::istringstream and std::ostringstream (in <sstream>) for
the details.
BTW, if the sender and receiver are on different platforms, or you
happen to need to send the data through something that has a problem
with binary data, you can use text_[io]archive instead of
binary_[io]archive.
HTH,
Todd Greer <tgreer <at> affinegy dot com>
Senior Software Developer, Affinegy LLC
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net