打开QFile进行追加

时间:2012-12-13 09:26:32

标签: c++ file qt qfile

如何打开QFile进行追加,即相当于

FILE *f = fopen("myfile.txt", "a");

1 个答案:

答案 0 :(得分:42)

QIODevice::Append模式打开文件:

QFile f(...);
if (f.open(QIODevice::WriteOnly | QIODevice::Append)) {
  ...
}

另请参阅documentation