Re: [gtkmm] minor problem with sorting rows in win32



I realise it's not the ideal way of getting things done, but since i'm
working on a client/server application there's always the possibility of
having two different locales in my network. If and when this is the case
functions like Sort() and string comparisons will give different output
on different machines and eventually corrupt data.

I know there are other, cleaner ways to accomplish data consistancy, but
if this get the job done it's fine with me.

Anyway, thanks for the advice and your help!

Bart

On Sun, 2004-04-25 at 17:24, Roger Leigh wrote:
> "B.Hakvoort" <bart hakvoort be> writes:
> 
> > It has been some time, but life's been busy lately. Thanks for
> > straightening things out. I "solved" it by calling setlocale(LC_COLLATE,
> > "nl_NL") in my application. 
> 
> If that's your usual locale, the right thing to do here is
> 
>   std::setlocale(LC_ALL, "");
> 
> which will read LANGUAGE, LANG, LC_ALL, and LC_* from the environment,
> rather than hard-coding anything (I would highly recommend this).
> Better still, the C++ way would be
> 
>   std::locale::global(std::locale("C"));
> 
> (which does the same sort of thing, but sets the "global" locale) and
> optionally
> 
>   std::cin.imbue(std::locale());
>   std::cout.imbue(std::locale());
>   std::cerr.imbue(std::locale());
>   std::clog.imbue(std::locale());
> 
> to "imbue" the standard streams with the new global locale.
> 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]