title: How to read a UCS-2 file?
body: <p>I'm writing a program to get the infomation in *.rc file encoding in UCS-2 Little Endian.</p>
  
  <pre><code>int _tmain(int argc, _TCHAR* argv[]) {
    wstring csvLine(wstring sLine);
    wifstream fin("en.rc");
    wofstream fout("table.csv");
    wofstream fout_rm("temp.txt");
    wstring sLine;
    fout &lt;&lt; "en\n";
    while(getline(fin,sLine)) {
      if (sLine.find(L"IDS") == -1)
        fout_rm &lt;&lt; sLine &lt;&lt; endl;
      else
        fout &lt;&lt; csvLine(sLine);
    }
    fout &lt;&lt; flush;
    system("pause");
    return 0;
  }
  </code></pre>
  
  <p>The first line in "en.rc" is <code>#include &lt;windows.h&gt;</code> but <code>sLine</code> shows as below:</p>
  
  <pre><code>[0]     255 L'ÿ'
  [1]     254 L'þ'
  [2]     35  L'#'
  [3]     0
  [4]     105 L'i'
  [5]     0
  [6]     110 L'n'
  [7]     0
  [8]     99  L'c'
  .       .
  .       .
  .       .
  </code></pre>
  
  <p>This program can work out correctly for UTF-8. How can I do it to UCS-2?</p>