+4  A: 
  • there is no OS Wide locale setting for Unix. There can be a default used for users which don't overwrite it, but most users do overwrite it. And it is quite common to leave it as "C".

  • there is no standard C or C++ way to get the information you want.

  • the posix way of getting information related to the locale is to set the locale and the use nl_langinfo() (that returns a char*). While there is no POSIX macro defined for the international phone code, glibc has an extension for it (_NL_TELEPHONE_INT_PREFIX).

Example:

#include <langinfo.h>
...
if (setlocale(LC_ALL, "") == NULL) {
   fprintf(stderr, "Unable to set locale.\n");
   abort();
}
printf("Telephone international prefix: %s\n", nl_langinfo(_NL_TELEPHONE_INT_PREFIX));
AProgrammer
I disagree (a bit) with you when you say that users overwrite it or that it is quite common to leave it at "C". It is not true when you are from a non english-speaking country. When you install your OS the locale is correctly set like fr_FR. Usually users do not change it, so you get correct locale when asking with system call. By the way +1 for your good answer ;)
neuro
We have it at C on the servers and at fr_FR on the workstations. When logging in on the servers, we set the correct environment variables and I'm far from alone to reset some environment variables to get only part of the localization (the error message translations are funny but confusing at time). I know we have customers doing the same (replacing the french by german, or finish or ... locales). So that seem common from where I'm. And obviously, you have to differentiate the default from the OS and the default from the desktop GUI, they can be different. Unix is configurable to the death!
AProgrammer