Boost logo

Boost :

Subject: Re: [boost] [iostreams] binary memory stream
From: Kenny Riddile (kfriddile_at_[hidden])
Date: 2009-03-30 23:48:25


Kim Barrett wrote:
> At 7:41 PM -0500 3/29/09, Kenny Riddile wrote:
>> I'm attempting to write to memory instead of a file, by doing this:
>>
>> using namespace boost::gil;
>> using namespace boost::iostreams;
>>
>> typedef stream< back_insert_device< std::vector<char> > > BufferStream;
>
> std::vector<char> vbuffer;
> boost::iostreams::filtering_ostream outs(
> boost::iostreams::back_inserter(vbuffer))
>
> is what I've been using to create an in-memory binary output stream.
> That is, a filtering stream that has only a sink and no intervening
> filters in the chain.
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>

That still appears to be converting the data to characters, similar to
opening a std::ofstream without explicitly putting it in binary mode.


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