版权声明:github博客地址https://ryanlee0129.github.io/wtf-blog/ 引用请注明 https://blog.csdn.net/u013288800/article/details/82597275
std::ifstream infile; //输入流
infile.open(conf, std::ios::in);
if(!infile.is_open ())
{
std::cout << "Open file failure" << std::endl;
}
else
{
while (!infile.eof()) // 若未到文件结束一直循环
{
infile >> res;
}
infile.close(); //关闭文件
if(res == "true")
{
std::ofstream openfile(conf);
openfile<<"false";
openfile.close();
}
}