📄 filewrite.cpp
字号:
/**
* FileWrite.cpp
*/
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ofstream outFile("FileWrite.out");
if (outFile.fail()) {
cerr << "Unable to open file for writing." << endl;
exit(1);
}
outFile << "Hello!" << endl;
outFile.close();
ofstream appendFile("FileWrite.out", ios_base::app);
if (appendFile.fail()) {
cerr << "Unable to open file for writing." << endl;
exit(1);
}
appendFile << "Append!" << endl;
appendFile.close();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -