Boost logo

Boost :

Subject: [boost] [iostreams] non buffered stream issues
From: Christopher Lux (christopherlux_at_[hidden])
Date: 2008-09-18 07:55:02


Hi,
i wrote my own file device to get large file support on windows without
the system caching the file.

now, when i use this device with boost::iostreams::stream or
stream_buffer all read and write access is buffered (default 4096). i
found the suggestion to create the stream or stream_buffer with a buffer
size of 0, but then the access to the read or write function of the
device are always for 1 byte. what can i do to get real unbuffered
access to the device.

another problem. i use the device with the default buffer size of 4096.
and access it like follows:

boost::iostreams::stream<mydevice> ifile;

char* buf = new char[3200];

for (int i = 0; i < 100; ++i) {
     ifile.seekg(32 * i, std::ios_base::beg);
     ifile.read(buf, 32);
}

now with the first read the buffer of 4096byte is filled up. then i seek
32 byte into the file and the next read operation AGAIN reads from the
device? why buffer when this case it not caught?

i am using boost 1.35.

regards
-chris

-- 
Christopher Lux |
                 | Bauhaus-Universität Weimar
                 | faculty of media - virtual reality systems group

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