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
2009-08-11 06:13:06