Re: g++ Locale ?? correction

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

 



Thanks Jonathan and Liu Hao, your suggestions and some tweaking did the job.
Here is what the member function looks like.

===========

void jme::Locale::setGlobalLocale(const std::string& str){
     char arg[str.length()+1];
     strcpy(arg, str.c_str());
     std::setlocale(LC_ALL, arg);
    /*** TODO ***/
/* assign the value returned by std::setlocale(...) to a std::wstring object */

}

===========


On 03-May-2017 12:23 PM, Jonathan Wakely wrote:
On 3 May 2017 at 17:04, Papa wrote:
Yes, absolutely right. That's what I thought as well.
Now, who should look at this problem, MinGW64 or Gnu, who should I contact
to report this bug?
MinGW's setlocale has nothing to do with GCC, it's provided by MinGW.

What happens if you use a non-statically allocated char* directly,
without involving std::string?


void jme::Locale::setGlobalLocale(const std::string&){
       char arr[] = "";
       std::setlocale(LC_ALL, arr );
}

Or maybe more likely to fail immediately:

void jme::Locale::setGlobalLocale(const std::string&){
       char* p = new char[1]();
       std::setlocale(LC_ALL, p );
       delete[] p;
}

--
ArbolOne.ca
Using FireFox and Thunderbird.
ArbolOne is composed of a group of students and volunteers
dedicated to providing free services to charitable organizations.




[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