NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: uselocale() function
Martin Husemann <martin%duskware.de@localhost> écrit :
> On Tue, Feb 14, 2017 at 12:39:52PM +0100, Marc Baudoin wrote:
> > Well, that piece of software happens to be written in C++. I
> > dont't know why the author doesn't use that model.
>
> In case it wasn't clear: what I meant is: set the locale for individual
> stream objects explicitly.
>
> Most simple example:
>
> cout.imbue(locale::classic());
> cout << 2.5f << endl;
>
> (this is a bad example as it modifies the global cout, which is nearly
> as bad as calling uselocale()/setlocale() or friends).
>
> In general you would open a stream on a file and then set its locale reference
> properly for that file. The C variant (printf_l(3)) is slightly
> worse, as you need to pass the locale on every output call.
Thanks.
Home |
Main Index |
Thread Index |
Old Index