用C++向一个txt文档中写数据

bool CMaked::WriteFileMake(CString filePath, const char *isChange)
{
	ofstream file;
        //filePath为该txt文档的全路径
	file.open(filePath, ios::out);//以写的方式打开,没有会创建
	if (file.is_open())
	{
		file << isChange << endl;
		file.close();
		return true;
	}
	return false;
}

  以上需要包含的头文件:#include <fstream>

原文地址:https://www.cnblogs.com/pengjun-shanghai/p/5070148.html