Boost logo

Boost Users :

From: Ashkan Aliabadi (ashkan.aliabadi_at_[hidden])
Date: 2008-03-05 12:58:08


Hello everybody,

I want a stream view of a dynamically allocated BYTE* buffer I have at hand.
At first I thought boost::iostreams::basic_array< BYTE > would do the job
since they're the closest thing I found in Boost IOStreams library, but as
it turns out I was wrong, since the code fails to compile with dynamically
allocated buffers.

typedef boost::iostreams::basic_array< unsigned char > MemoryDevice;
typedef boost::iostreams::stream< MemoryDevice > MemoryStream;

BYTE* mem = new BYTE[ 1000 ];
MemoryDevice memoryDevice( mem );
MemoryStream memoryStream( memoryDevice );

I was wondering if there are any available streams that are capable of
providing stream-like behavior to such buffers, or should I write a device
to handle them?

Any help is greatly appreciated.



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net