ofstream 追加模式
#include
using namespace std;
int main() {
ofstream outfile("example.txt", ios::app);
if (outfile.is_open()) {
outfile << "This is a new line.\n";
outfile.close();
}
else cout << "Unable to open file" << endl;
return 0;
}
浙公网安备 33010602011771号