2024-12-01 08:19:36
是不是这个意思啊。。。
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream file_first;
file_first.open( "file1.txt" );
file_first << "this is the first file" << endl;
file_first.close();
if( !file_first.is_open())
file_first.open("file2.txt");
file_first << "this is the second file" << endl;
return 0;
}