bool writeUnicodeText(LPCWSTR path)
{
FILE* file = NULL;
_wfopen_s(&file, path, L"wb");
if(file) return false;
LPCSTR header = "\xFF\xFE";// Unicode (UTF16 Little Endian)
fwrite(header, sizeof(char), 2, file);// => FF FE
fwrite(L"abc", sizeof(WCHAR), 3, file);
fwrite(L"\r\n", sizeof(WCHAR), 2, file);// => 0D 00 0A 00
// fwrite(L"\x0Dx0A", sizeof(WCHAR), 2, file);// => 0D 00 0A 00
fclose(file);
return true;
}
最終更新:2012年01月13日 18:30