#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