
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