title: How to get windows xp gui default code page?
body: <p>The thing is that on non-english versions of XP code pages for console and gui apps differ, for example if I on my Polish version write in console:</p>
  
  <pre><code>echo zażółć gęślą jaźń &gt; somefile.txt
  </code></pre>
  
  <p>The content of that file is:</p>
  
  <pre><code>zaľ˘† g©lĄ ja«ä 
  </code></pre>
  
  <p>This isn't happening if I put that into cmd file. That is this text with polish letters. But if I create a file or directory that is named using non English only chars, then no matter if it's run from cmd or from finger the effect is always gibberish.</p>
  
  <p>So my question is how to get this second code page that rest of windows is running with. In my case this CP is 1250 - but how to get this number from c++ ?</p>
  
  <p><code>GetConsoleCP()</code> and <code>GetConsoleOutputCP()</code> both return 852 (which is correct) and <code>GetThreadLocale()</code> gives 1045.</p>
  
  <p>If I try to <code>chcp 1045</code> it gives "wrong code page".</p>