If you try to append some text in an existing file it does not append rather it over writes it in the begining of the file, attached example shows this behavior
#include <QFile> #include <QDebug> int main(int argc, char *argv[]) { QFile file("myNewTestfile.txt"); bool ret = file.open(QIODevice::WriteOnly); Q_ASSERT(ret); file.write("Testing First line\nTesting other line"); ret = file.flush(); Q_ASSERT(ret); file.close(); Q_ASSERT(!file.isOpen()); ret = file.open(QIODevice::WriteOnly | QIODevice::Append); Q_ASSERT(ret); file.write("APPEND new Line"); ret = file.flush(); Q_ASSERT(ret); file.close(); }
It is reported that it is limited to Windows only it works good on Linux