How can I open a QFile for appending, i.e. the equivalent of

FILE *f = fopen("myfile.txt", "a");
有帮助吗?

解决方案

Open the file in QIODevice::Append mode:

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

See also the documentation.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top