g++ and locale on Solaris 10

C

chris.d.williams

I am trying to use std::locale with g++ 3.4.2 on Solaris 10 and I can't
set any locale other than C or POSIX. I get the following exception
everytime, Error for en_US: locale::facet::_S_create_c_locale name not
valid. Here is what my program looks like. Anyone else having this
problem or any idea why this is happening? When run the locale -a
command, I see a whole list of locales installed on the system other
that C and POSIX.

Thanks
CW

#include <iostream>
#include <locale>

using namespace std;
int main(int argc, char **argv) {
for (int ii = 1; ii < argc; ++ii) {
try {
locale loc(argv[ii]);
cout << "Created locale " << loc.name() << endl;
}
catch (exception & e) {
cout << "Error for " << argv[ii] << ": " << e.what() << endl;
}
}
return 0;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,163
Latest member
Sasha15427
Top