title: How to get current locale of my environment?
body: <p>Had tried following code in Linux, but always return 'C' under different <code>LANG</code> settings.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;locale.h&gt;
  #include &lt;locale&gt;
  using namespace std;
  
  int main()
  {
      cout&lt;&lt;"locale 1: "&lt;&lt;setlocale(LC_ALL, NULL)&lt;&lt;endl;
      cout&lt;&lt;"locale 2: "&lt;&lt;setlocale(LC_CTYPE, NULL)&lt;&lt;endl;
  
      locale l;
      cout&lt;&lt;"locale 3: "&lt;&lt;l.name()&lt;&lt;endl;
  }
  
  $ ./a.out
  locale 1: C
  locale 2: C
  locale 3: C
  $
  $ export LANG=zh_CN.UTF-8
  $ ./a.out
  locale 1: C
  locale 2: C
  locale 3: C
  </code></pre>
  
  <p>What should I do to get current locale setting in Linux(like Ubuntu)? </p>
  
  <p>Another question is, is it the same way to get locale in Windows? </p>