According to the C++ Reference setlocale(...) returns a 'char*',
however, when trying to assign this function's return value to another
'char*', it creates an run time error.
Here is my example:
<snip>
void jme::Locale::setGlobalLocale(const std::string& str){
char* arg = new char[str.length()+1];
strcpy(arg, str.c_str()); // const char* to char* -- Works
char* cp = new char[1024];
strcpy(cp, std::setlocale(LC_ALL, arg)); // char* to char* --
Does not work ??
delete arg;
delete cp;
}
</snip>
The code compiles, but as I said before it does not run.
What am I missing? How can I solve this problem?
--
ArbolOne.ca
Using FireFox and Thunderbird.
ArbolOne is composed of a group of students and volunteers
dedicated to providing free services to charitable organizations.