On Sat, 2 Dec 2023 at 03:49, Mayuresh <mayur...@acm.org> wrote:
>
> I am using gcc 12.1 on NetBSD 9.3 amd64 in a c++ application that complies
> using standard std20.
>
> There is this c++ standard library class ifstream. Using method
> ifstream::open files are opened.
>
> So far I was under an impression that on BSDs / Linux / Unix like systems
> there is no need to explicitly pass the "b" option ( ifstream::binary in
> case of above API ) and that such option is required only on DOS / Windows
> systems.
>
> But I found that without this option, on above setup, the things were not
> working (weird results you'd expect with implicit character conversions).
> Using above option solves the problem.
>
> On NetBSD, the fopen man page clearly says 'b' is ignored. So wonder if
> gcc layer introduces the need to use it in above usage pattern.
>
> A bit surprised by this behavior. Comments please.

Could something in the c++ library be assuming UTF-8 for non binary files?

David

Reply via email to