Re: Language localization with streams under C++

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

 



"Heilmann, Thomas (GE51)" <thomas.heilmann@xxxxxxxxxxxxx> writes:

> Hello,
> 
> may be you can help me with my problem about language localization.
> 
> As I read in the documentation, for example "setlocale( LC_ALL, "German" );"
> is the common way to set the language localization. But this will be valid
> for
> the whole program and it is not that what I want and need.
> 
> While programming with C++, there's the possibility to create a "locale"
> object
> and imbue a stream with it. Then this language localization is only valid
> for
> this stream and its life cycle. That is what I want and need.
> 
> Here a small example:
>    std::ofstream OutFile;
>    std::locale Local_German( "German" );
>    OutFile.imbue( Local_German );
> 
> My problem is now, that this code is compilable, but while the program is
> running
> and would create this object 'Local_German', it crashes.
> I checked this with several locale strings like "C", "", "English" and some
> more.
> With the first two, the locale object is created well and the program is
> running well.

You must have glibc 2.2.5 or newer for C++ locale support to
    work. Also, I do not know if a German locale is supported in
    C++. (Nor do I know where to find out.) What I have heard is that
    3.2 supports only C and English locales, however I cannot find
    official verification of this.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux