When porting from QFile:
QSaveFile sf(path);
if (sf.open(QIODevice::WriteOnly)) {
sf.write("Hello\n");
ok = sf.commit();
if (ok)
qDebug() << "Wrote " << sf.size() << " bytes to " << path;
}
prints
Wrote 0 bytes to "/tmp/test.txt" Empty filename passed to function
- duplicates
-
QTBUG-66605 QSaveFile::fileTime() fails after QSaveFile::commit()
-
- Closed
-
- relates to
-
QTBUG-75077 QSaveFile truncates file due to incorrect commit/flush handling
-
- Reported
-