Boost logo

Boost :

From: James Porter (porterj_at_[hidden])
Date: 2008-03-10 17:50:39

On Mon, Mar 10, 2008 at 4:40 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:
> Perhaps, also, I am misunderstanding Boost.Iostreams. Please clarify.
> Thanks.

You're running into an issue with buffering. Even though you only need
8 bytes, the stream buffer has a 4096 byte buffer and will try to fill
it up. Unfortunately, there isn't much documentation on how
Boost.Iostreams handles buffering.

There are basically three options:
1) create the stream buffer directly and supply a buffer size, then
pass the buffer to a boost::iostreams::stream object
2) use 'optimally_buffered_tag' in your device's category and make a
member function called optimal_buffer_size() that returns an
std::streamsize of 0
3) perform validation in your read method to ensure you aren't reading too much

- Jim

Boost list run by bdawes at, gregod at, cpdaniel at, john at