This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Language localization with streams under C++


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.
But with any other local string it crashes.

What's wrong with this ?
Is there anything missing on my SuSE 8.1 with gcc 3.2 system ?

Any comment helping me to solve that problem is welcomed !

Best regards

                  Thomas Heilmann


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]