Boost logo

Boost :

From: Alexander Dong Back Kim (alexdbkim_at_[hidden])
Date: 2008-08-08 20:53:00


On Fri, Aug 8, 2008 at 9:42 PM, Jeff Flinn <TriumphSprint2000_at_[hidden]>wrote:

> Dean Michael Berris wrote:
>
>> On Fri, Aug 8, 2008 at 1:28 PM, Alexander Dong Back Kim
>> <alexdbkim_at_[hidden]> wrote:
>>
>>> What I want to ask here is how I can avoid to create a file and fill the
>>> data array instead by using boost serialization? Any comments will be
>>> appreciated.
>>>
>>>
>> Try using a stringbuf, then wrap it in an std::ostream, which you then
>> use to initialize the archive:
>>
>> std::stringbuf buffer;
>> std::ostream stream(&buffer);
>> text_oarchive archive(stream);
>>
>> HTH
>>
>>
> Or
>
> std::ostringstream oss;
> text_oarchive archive(oss);
>
> or see the boost::iostreams library to provide a stream or stream_buffer
> that directly writes to a container or any other memory you provide.
>
> Jeff Flinn
>
>
Oh! This is alos really good suggestion! I will go and dig more on
boost::iostreams library =)
Thanks a lot.

-- 
Alexander Dong Back Kim
Australia +61 433 469 100 / Korea +82 10 6357 8840

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk