Web lists-archives.org

[Mingw-users] Problem with setlocale




I have some problem with setlocale() - when I try to change
output code page it does not work. I use this example to
test setlocale():

#include <stdio.h>
#include <locale.h>

int main(int argc, char *argv[])
{
    try
       {
          char  text[]="Привет";
          setlocale(LC_CTYPE,".866");
          puts(text);
          setlocale(LC_CTYPE,".1251");
          puts(text);
       }
    catch (...)
       {
          printf("catch exception");
       };
    return 0;
};

Build by command
g++ main.cpp -o 1.exe

Program print two identical string, but in different code
page it must be different text.

I test it with gcc-*-3.4.5-20060117-1 and 
gcc-*-3.4.5-20060117-2.

In VS this code work fine.

What I do wrong?

P. S.
Sorry for my english.



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users