|
Boost : |
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2005-03-18 07:28:26
Vladimir Prus wrote:
> Jonathan Turkanis wrote:
>
>> Vladimir Prus wrote:
>>> Hello,
>>> I wonder if the iostreams library allows me to get an istream that
>>> will read a part of a file. That is: I specify a file, start offset
>>> and end offset. The resulting istream begins reading at start offset
>>> and returns EOF when it arrives at end offset.
>>
>> There wil be an offset filter very soon.
>
> Will it also allow to specify end offset. Start offset is not a
> problem -- I can always seek the stream. It's the end offset that's
> problematic.
Yes.
>>> Also: the POSIX mmap call allows one to specify start and end
>>> offset. However, the mapped_file_source does not allow to specify
>>> that, and documentation does not clearly explain why one would want
>>> to use that class at all.
>>
>> It looks like the docs are over-simplified. Looking at the source I
>> see the following constructors:
>>
>> mapped_file_source( const std::string& path,
>> size_type length = max_length,
>> boost::intmax_t offset = 0 );
>>
>> mapped_file_sink( const std::string& path,
>> size_type length = max_length,
>> boost::intmax_t offset = 0 ) ;
>>
>> mapped_file( const std::string& path,
>> ios::openmode mode =
>> ios::in | ios::out,
>> size_type length = max_length,
>> boost::intmax_t offset = 0 ) ;
>
> This looks suitable for my problem.
Good.
Jonathan
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk