黄粉虫养殖技术,潘道津,寇振海老婆李婷
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();
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
如何在没有core文件的情况下用dmesg+addr2line定位段错误
用QT制作3D点云显示器——QtDataVisualization
网友评论