.我是c ++的新手.我必须找出文件包含的用户传递的编码类型.但我不知道如何检查文件的编码.所以我需要的是打印文件是unicode还是ansi或unicode big endian或utf8.I已搜索了很多但无法找到解决方案.直到现在我已经完成了我已经打开了一个文件:
#include "stdafx.h"
#include <iostream.h>
#include <stdio.h>
#include<conio.h>
#include <fstream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
fstream f;
f.open("c:\abc.txt", fstream::in | fstream::out); /* Read-write. */
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
所以任何人都可以告诉我代码解决方案.
如果我正在访问记事本文件怎么办?
Thanx提前..