我正在用Qt C++编写一个程序来创建一种数据库。但是,无论何时我按下按钮,它都会覆盖整个文件,而不是像我需要的那样继续执行新的一行。我真的很感激任何有关如何解决这个问题的信息。Qt C++继续文件而不覆盖
相关的代码部分:
QFile file("C:/Users/brandan/Desktop/GUIPrograms/Kumon.txt");
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream stream(&file); //stream of information
stream << " " << endl;
stream << name << " " << month << " " << day << " " << year << " " << page << endl;
file.close();
http://qt-project.org/doc/qt-4.8/qiodevice.html #OpenModeFlag-enum – cageman
[Open QFile for appending]的可能重复(http://stackoverflow.com/questions/13856734/open-qfile-for-appending) – sashoalm