Boost logo

Boost :

From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-03-10 17:40:03


Hi,

>From my research on Iostream devices, I cannot understand why my read()
statement's 'count' parameter is receiving a value of 4096. For example,
I've implemented a seekable_device_tag category device that provides direct
binary disk access. My stream is defined as follows:

typedef boost::iostreams::stream<DiskDevice> DiskStream;

DiskStream stream;

char* buffer; // assume this is a valid buffer
stream.read( buffer, 8 );

The code above (at least to me) should be reading in 8 char's (bytes) of
data from the stream. However, if I set a break point in DiskDevice::read(),
the second parameter (named count) receives a value of 4096, which
eventually gets passed into fread() and causes an exception. I also noticed
that boost::iostreams::stream derives from the standard streams, which I
imagine is causing the problems. For direct binary disk access, should I
avoid boost.iostreams all together? I don't like that boost::stream is going
through std::iostream::read() before reaching my device's read function.

Perhaps, also, I am misunderstanding Boost.Iostreams. Please clarify.
Thanks.


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