[C++]普通文本文件最佳读取方式

it2022-05-05  115

#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>())); }

 

转载于:https://www.cnblogs.com/jingdian1956/p/6543924.html


最新回复(0)