小编gos*_*eta的帖子

如何读取UCS-2文件?

我正在编写一个程序来获取UCS-2 Little Endian中*.rc文件编码的信息.

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 << "en\n";
  while(getline(fin,sLine)) {
    if (sLine.find(L"IDS") == -1)
      fout_rm << sLine << endl;
    else
      fout << csvLine(sLine);
  }
  fout << flush;
  system("pause");
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

在"en.rc"的第一行是#include <windows.h>sLine如下所示:

[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'
.       .
.       . …
Run Code Online (Sandbox Code Playgroud)

c++ unicode encoding character-encoding wofstream

4
推荐指数
1
解决办法
4250
查看次数

标签 统计

c++ ×1

character-encoding ×1

encoding ×1

unicode ×1

wofstream ×1