• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with std::locale
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with std::locale


  • Subject: Re: Problem with std::locale
  • From: "Jim Crafton" <email@hidden>
  • Date: Tue, 22 Apr 2008 13:52:29 -0400

I found when I tried this stuff several years ago that most of it did
not work like I expected and I eventually gave up on it. Instead I
just used the OS X Carbon routines for locale stuff. Good luck.

On Mon, Apr 21, 2008 at 4:34 PM, Dave Carrigan <email@hidden> wrote:
> The following code is not giving expected results. I would expect that any
> locale that can be set using setlocale() could be set by instantiating a
> locale, but in fact, the only locales that I can instantiate are C and
> POSIX.
>
>  Any insights?
>
>  ------------------------------------------------------------
>  #include <locale>
>  #include <iostream>
>  #include <stdexcept>
>
>  using namespace std;
>
>  int main(int argc, char *argv[])
>  {
>   char const* loc = argv[1];
>
>   if (std::setlocale(LC_ALL, loc)) {
>     cout << loc << ": good C locale; ";
>   } else {
>     cout << loc << ": bad C locale; ";
>   }
>
>   try {
>     locale l(loc);
>     cout << "good C++ locale" << endl;
>   } catch (runtime_error& e) {
>     cout << "bad C++ locale (" << e.what() << ")" << endl;
>   }
>
>   return 0;
>  }
>  ------------------------------------------------------------
>
>  $ g++ -o loctst loctst.cc
>  $ for loc in C POSIX en_US; do ./loctst $loc; done
>  C: good C locale; good C++ locale
>  POSIX: good C locale; good C++ locale
>  en_US: good C locale; bad C++ locale (locale::facet::_S_create_c_locale
> name not valid)
>
>
>  --
>  Dave Carrigan
>  email@hidden
>  Seattle, WA, USA
>
>
>  _______________________________________________
>  Do not post admin requests to the list. They will be ignored.
>  Xcode-users mailing list      (email@hidden)
>  Help/Unsubscribe/Update your Subscription:
>
>  This email sent to email@hidden
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem with std::locale (From: Dave Carrigan <email@hidden>)

  • Prev by Date: Re: thin linking: "file is not of required architecture"
  • Next by Date: Setting up Subversion repositories in XCode 3.0
  • Previous by thread: Re: Problem with std::locale
  • Next by thread: Re: Problem with std::locale
  • Index(es):
    • Date
    • Thread