#include <comdef.h>
#pragma comment(lib, "comsupp.lib")
#include <locale.h>
//用来配置地域的信息,设置当前程序使用的本地化信息,加载中文时显示正常
setlocale(LC_CTYPE, _com_util::ConvertBSTRToString(_T("chs")));
FILE *fileHandle=_wfopen(strCurFilePath, _T("a, ccs=UTF-8"));
if (fileHandle!=NULL)
{
CString strToWriteHead;
strToWriteHead.Format(_T("</Setting>\n"));
if (fwrite(strToWriteHead, sizeof(wchar_t), strToWriteHead.GetLength(), fileHandle) != strToWriteHead.GetLength())
{
wprintf(L"fwrite failed!\n");
}
fclose(fileHandle);
}