#include <afx.h>
/******************************************************************
函數名稱:IsUnicodeFile
函數功能:判斷某個文件是否是unicode文件
輸入參數:
輸出參數:int -1:表示該文件不存在,
0:表示不是unicode文件,
1:表示是unicode文件
作者: 鹽城湯菜-管砥羣
備註:491258707
******************************************************************/
int IsUnicodeFile(PTSTR pstrName)
{
try
{
CFile cf(pstrName, CFile::modeRead );
BYTE ch[100];
memset(ch, 0, 100);
int ii = cf.Read(ch, 100);
cf.Close();
int i = 0;
int iU = IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_REVERSE_SIGNATURE;
if(IsTextUnicode(ch, 100, &iU))//是否是unicode文件
{
return 1;
}
return 0;
}
catch (CException* e)
{
return -1;
}
return 0;
}
判斷某個文件是否是unicode編碼的
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.