#include <locale.h> #include <stdio.h> #include <langinfo.h> #if defined(linux) && !defined(CODESET) #define CODESET _NL_CTYPE_CODESET_NAME #endif /* linux */ int main() { char* loc = setlocale(LC_ALL, “”); if (loc) { printf(“default locale: %s\n”,loc); printf(“encoding %s\n”, nl_langinfo(CODESET)); } else printf(“System does not support this locale\n”); return 0; } |
#include <locale.h> #include <stdio.h> #include <windows.h> int main(int argc, char* argv[]) { printf(“default locale: %s\n”, setlocale(LC_ALL, “”)); printf(“encoding %d\n”, GetACP()); return 0; } |