Re: [Boost-users] Need help in serialization

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

Thanks a lot Todd. Really appreciate your help. Regards, Anil On 8/4/06, Todd Greer <TGreer@affinegy.com> wrote:
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 mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Anil Krishna
-
Todd Greer