利用boost/locale和ofstream写utf8格式文件
来源:互联网 发布:国密算法介绍 编辑:程序博客网 时间:2024/06/17 23:41
每次都在以前代码中找这段代码,现在放上来,方便查找。
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/utf8_codecvt_facet.hpp>#include <boost/locale.hpp>
#include <fstream>
std::ofstream txtFile;
std::locale oldLocale;
std::locale utf8Locale(oldLocale, new boost::program_options::detail::utf8_codecvt_facet());
txtFile.imbue(utf8Locale);
txtFile.open(txtPath, std::ios::app);
if (!txtFile)
{
throw -1;
}
txtFile<< boost::locale::conv::to_utf<char>(text,"gb2312");
txtFile.close();
- 利用boost/locale和ofstream写utf8格式文件
- 读写Unicode和UTF8格式文件
- boost库学习随记五 Boost.Locale 之字符转换 gbk utf8 big5 string wstring等
- Boost.Locale 之字符转换 gbk utf8 big5 string wstring等
- Boost.Locale 之字符转换 gbk utf8 big5 string wstring等
- PHP生成utf8格式文件
- 另存为UTF8格式文件
- boost.locale 初用
- ofstream写文件
- ofstream写、ifstream读
- Ofstream写文件
- 使用 Boost 的Locale 進行字碼轉換
- Boost.Locale 本地化库 ...待续...
- 使用 Boost 的Locale 進行字碼轉換
- 使用PL/SQL的UTL_FILE写xls和csv格式文件
- Qt5 写DOS格式文件
- c++ 写.mat格式文件
- 昨天和今天工作了2天,利用以前写好的宏,把boost::tuple 作了一个扩展。
- word2vec
- WPF鼠标划线测距——模仿电子地图测距
- android编译调试选项——dump-module-variables
- GMM 与 KDE 区别与联系
- Android开发杂记
- 利用boost/locale和ofstream写utf8格式文件
- Python--shutil--copy--复制文件
- Linux 操作系统 SIGTERM等信号意义
- [VC]使用内存映射技术对文件进行倒序
- 用小数点去切割字符串
- 编码素养问题收集4:MySQL数据导入导出如何证明结果是正确的?
- MyEclipse10集成Jboss7
- ViewBag 和ViewData 区别
- 进程间的通信机制