#include <fstream>
ofstream fout;
fout.open(“filename”);
//文件打开是否失败
if(fout.fail())
exit(1);
fout<<” ";