title: Outputting all 255 ASCII/ANSI/ISO characters into a file
body: <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  
  
  int main()
  {
      FILE* oFile=fopen("file","wb");
  
      for(int i = 255; i&gt;=0; i--)
          fprintf(oFile,"%c",i);
  
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>Now, "file" contains ONLY "weird" characters:</p>
  
  <p>����훗퓕틓탑컏쳍쫋죉웇쓅싃상뺿벽못뢹뚷뒵늳낱꺯겭ꪫꢩꚧ꒥ꊣꂡ麟鲝骛颙隗钕銓邑躏貍誋袉蚇蒅芃肁繿籽穻硹癷瑵牳灱湯汭橫桩晧摥扣恡幟屝婛塙噗呕剓偑乏䱍䩋䡉䙇䑅䉃䁁㸿㰽㨻㠹㘷㐵㈳〱ⸯⰭ⨫⠩☧␥∣‡ḟᰝᨛ᠙ᘗᐕሓထฏ఍਋ࠉ؇Ѕȃ</p>
  
  <p>What's intriguing for me, using a console stream, everything is OK.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;iostream&gt;
  
  
  
  
  int main()
  {
  
  
      for(int i = 255; i&gt;=0; i--)
          printf("%c",i);
  
      system("pause");
      return 0;
  }
  </code></pre>
  
  <p>The question is: why there are no "latin" characters in the output file? Even after converting from UCS-2 little endian(why it was automagically selected?) to ascii in the notepad++:</p>
  
  <p>ďł˝ď«»ďŁąď›·ď“µď‹łď±î»Żîł­î««îŁ©î›§î“Ąî‹Łîˇí»źíłťí«›íŁ™í›—í“•í‹“í‘ě»ŹěłŤě«‹ěŁ‰ě›‡ě“…ě‹ěëşżë˛˝ëŞ»ë˘ąëš·ë’µëŠłë‚±ęşŻę˛­ęŞ«ę˘©ęš§ę’ĄęŠŁę‚ˇéşźé˛ťéŞ›é˘™éš—é’•éŠ“é‚‘čşŹč˛ŤčŞ‹č˘‰čš‡č’…čŠč‚çążç±˝ç©»çˇąç™·ç‘µç‰łç±ćąŻć±­ć©«ćˇ©ć™§ć‘Ąć‰Łćˇĺąźĺ±ťĺ©›ĺˇ™ĺ™—ĺ‘•ĺ‰“ĺ‘äąŹä±Ťä©‹äˇ‰ä™‡ä‘…ä‰äă¸żă°˝ă¨»ă ąă·ăµăłă€±â¸Żâ°­â¨«â ©â§âĄâŁâ€ˇá¸źá°ťá¨›á ™á—á•á“á€‘ŕ¸Źŕ°Ťŕ¨‹ŕ ‰Ř‡Đ…Č</p>