如何将文本附加到C ++中的文本文件? [英] How to append text to a text file in C++?
本文介绍了如何将文本附加到C ++中的文本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在C ++中将文本附加到文本文件?
How to append text to a text file in C++? Create new if does not exist and append if exist.
推荐答案
#include <fstream>
int main() {
std::ofstream outfile;
outfile.open("test.txt", std::ios_base::app);
outfile << "Data";
return 0;
}
这篇关于如何将文本附加到C ++中的文本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文