From: <no...@so...> - 2002-02-02 23:57:37
|
Bugs item #512217, was opened at 2002-02-02 13:36 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=512217&group_id=2435 Category: w32api Group: None Status: Open Resolution: None Priority: 5 Submitted By: Alexander Peek (artisjok) Assigned to: Earnie Boyd (earnie) Summary: setlocale fails with c++ cin and cout Initial Comment: I am working with w32api 1.2. I am using the setlocale function (from locale.h) to change the decimal_point behavior of cin and cout in C++. This doensn't work. However, on Linux (suse 7.3), I have setlocale working with cin and cout. After some testing with w32api, I found that setlocale only works for scanf and printf functions. In addition, language-strings which setlocale accepts are different for Linux and w32api. With Linux, "en_US" and "nl_NL" are accepted. With w32api, these are not accepted, but "nld" and "usa" are accepted. Executing the following code shows the problem: setlocale(LC_ALL, "nld"); cout << "after nld : setlocale = " << setlocale (LC_ALL, NULL) << endl; cout << "cout: x= " << (float)1234/3 << endl; printf("printf: x= %f\n", (float)1234/3); setlocale(LC_ALL, "usa"); cout << "after usa : setlocale = " << setlocale (LC_ALL, NULL) << endl; cout << "cout: x= " << (float)1234/3 << endl; printf("printf: x= %f\n", (float)1234/3); How can I get it working? Thanks in advance, Alexander ---------------------------------------------------------------------- >Comment By: Danny Smith (dannysmith) Date: 2002-02-02 15:57 Message: Logged In: YES user_id=11494 In libstdc++, only C-locale is currently supported under mingw in iostream classes. setlocale changes the setting of the current active locale. It doesn't affect the static global C-locale. The language strings accepted by setlocale are outside mingw's control. They are determined by the MS runtime, which supplies setlocale. ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=102435&aid=512217&group_id=2435 |