Boost logo

Boost Users :

Subject: Re: [Boost-users] Binary (non-character-based) file iterators
From: Jason Felice (jason.m.felice_at_[hidden])
Date: 2009-12-24 13:19:04


On Mon, Dec 21, 2009 at 8:08 PM, Jason Felice <jason.m.felice_at_[hidden]> wrote:
> On Mon, Dec 21, 2009 at 3:41 PM, Scott McMurray <me22.ca+boost_at_[hidden]> wrote:
>> 2009/12/21 Jason Felice <jason.m.felice_at_[hidden]>:
>>> I'm looking for binary (value_type = unsigned char) input and output
>>> iterators for files.  This is as opposed to a character base iterator
>>> (which rules out ostream_iterator<>).
>>>
>>
>> If you can accept char instead of unsigned char, then use the standard
>> streambuf iterators, istreambuf_iterator and ostreambuf_iterator.
>
> Can I rely on there being no character set or line ending translation
> for an istream_iterator<char>, even with ios::binary?  I thought not.
>

The answer appears to be "yes". After much research, the
codecvt<char,char,..> locale facet is specialized to do nothing, so no
character set conversion will occur for narrow versions of the stream,
regardless of locale. (ios::binary is required, of course).


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