[C++]普通文本文件最佳读取方式
2017-03-13 17:15
246 查看
#include <string> #include <fstream> #include <streambuf> inline std::string loadFileEx(const char* path) { setlocale(LC_ALL,"Chinese-simplified");//设置环境中文 std::ifstream ifs(path); setlocale(LC_ALL,"C");//还原环境 return std::string((std::istreambuf_iterator<char>(ifs)), (std::istreambuf_iterator<char>())); }
相关文章推荐
- C和C++分别读取文本文件的方式
- 收集两个C++写的从文本文件中读取数据保存到数组的程序
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- C++代码一次读取文本文件全部内容到string对象
- 反射的应用,读取properties配置文件中的数据(普通InputStream方式,类加载方式),再调用运行
- 用标准C++读取固定格式的文本文件
- objective-c 读取文本文件编码方式(stringWithContentsOfFile和initWithContentsOfFile) .
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- iphone读取文本文件编码方式
- [libexpat]_[XML处理]_[C/C++使用libexpat库以数据流(SAX模型)的方式读取(解析)大XML文件]
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- C++读取文本文件
- [转]C++按行读取文本文件
- C++ 读写文本文件、统计文件的行数、读取文件数据到数组
- 一个C++按行读取Unicode 文本文件的例子
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组 (转)
- C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- 【转载】C++ 简单读写文本文件、统计文件的行数、读取文件数据到数组
- [libexpat]_[XML处理]_[C/C++使用libexpat库以数据流(SAX模型)的方式读取(解析)大XML文件]