Re: [Boost-users] [Serialization] Serializing to a void * and a size?
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Baranowski, Daniel Sent: Wednesday, October 11, 2006 2:06 PM To: boost-users@lists.boost.org Subject: [Boost-users] [Serialization] Serializing to a void * and a size?
I guess my questions is, what's the best way to serialize to a void * and a size? I'm pretty illiterate on streams, so I've started to read up on it, but I haven't figured it out yet, though I feel that's probably where the answer lies.
std::ostringstream sTestBinary1; boost::archive::binary_oarchive oa(sTestBinary1); oa << *pA;
// Get the size of the buffer and a pointer to it size_t iSize = 0;//sTestBinary1.size(); // ?? How do I get the size ?? void * pVoid = sTestBinary1.rdbuf(); // ?? Is this the right pointer ??
[Nat] Are you familiar with the std::ostringstream::str() method?
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Nat Goodspeed Sent: Thursday, October 12, 2006 11:40 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] [Serialization] Serializing to a void * and asize?
[Nat] Are you familiar with the std::ostringstream::str() method?
That's what I needed! I need to read up on streams (obviously). I had
seen that function before, but I guess I was stuck in the mind-set that
there would be a problem if there was a zero in the "string". I played
around with it and it work just fine!
Thanks a bunch Nat, you've been a big help. Glad it was a simple
solution.
And while I'm at it, thanks to Robert for making the library in the
first place!
V/R,
Daniel
And for completeness, here is the code:
#include <sstream>
#include <string>
#include
participants (2)
-
Baranowski, Daniel
-
Nat Goodspeed