Question

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

FILE *f = fopen("myfile.txt", "a");
Était-ce utile?

La solution

Open the file in QIODevice::Append mode:

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

See also the documentation.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top