void saveWideFileHead(std::ofstream& out)// 写入文件内容前,先写入BOM
{
char const* const utf16head = "\xFF\xFE";
out.write(utf16head, 2);
} void saveWideFileContent(std::ofstream& out, wchar_t const* str, int size)
{
char const* pos = (char const*)str;
out.write(pos, size);
} void saveWideFileCRLF(std::ofstream& out)// 写入回车换行符
{
char const* const utf16head = "\x0D\x00\x0A\x00";
out.write(utf16head, 4);
} void Test()
{
std::ofstream of("test.log", std::ios::binary | std::ios::out);
saveWideFileHead(of);
CString str("hello中国world1234");
saveWideFileContent(of, str, str.GetLength() * 2);
saveWideFileCRLF(of);
saveWideFileContent(of, str, str.GetLength() * 2);
of.close();
}

  

最新文章

  1. sql server报:名称 不是有效的标识符
  2. sql编程(四)触发器
  3. WinStore之Application Data
  4. Spring-事物配置
  5. CF 161D Distance in Tree 树形DP
  6. CAT XQX --- 省市三级级联实现说明
  7. <亲测好使>mac os 安装mcrypt扩展
  8. Android Service 的一些笔记
  9. Linux趣谈
  10. 重写equals()与hashCode()方法
  11. R.layout.main connot be resolved 和R.java消失
  12. SQL Server Alwayson读写分离配置
  13. hdu4416 Good Article Good sentence (后缀数组)
  14. python入门:python包管理工具pip的安装
  15. C# 给现有PDF文档添加页眉、页脚
  16. Codeforces 1096F(dp + 树状数组)
  17. spring-boot (三) spring data jpa
  18. Hiho #1075: 开锁魔法III
  19. Java之路(三) 控制执行流程
  20. MyBatis各种类型的入参使用方式

热门文章

  1. cin读取不知行列数的矩阵以及带逗号的整型数据
  2. Azure之旅
  3. 阿里八八“好记”——UML设计
  4. c++计算器后续(2)
  5. post注入及提权思路
  6. Hive安装报错
  7. Webpack知识汇总
  8. Jenkins获取编译状态
  9. Xiaocms验证码绕过分析
  10. Odoo权限控制