首先,在C++中对文件进行操作,要包含头文件
#include <fstream>
using namespace std;
然后是打开文件
ofstream outfile("data.txt",ios::trunc);//data.txt里面的内容会被清空
ofstream outfile("data.txt"
首先,在C++中对文件进行操作,要包含头文件
#include <fstream>
using namespace std;
然后是打开文件
ofstream outfile("data.txt",ios::trunc);//data.txt里面的内容会被清空
ofstream outfile("data.txt"