Recommendation for QSaveFile commit()
-
@rhb327 said in Recommendation for QSaveFile commit():
Is it still required to run system("sync") after a QSaveFile's commit() call?
Why should it? Where in the documentation did you read such a strange recommendation?
-
No, I didn't see it recommended anywhere. By "required", I mean should I run system("sync") after a call to commit() to ensure an embedded file in eMMC or on a USB is truly updated or does commit() guarantee the same file status as system("sync")?
One reason I ask, in my testing, I occasionally see a file like: xxxx.csv.BHYUIS vs. xxxx.csv on an export to USB. I have not determined root cause for this but on inspection of the file contents it looks like the full data is in the csv is truly there but the final move by QSaveFile did not appear to occur. In this specific case I'm not replacing a file but generating one.
Thanks,
-Rich -
This is a OS problem, nothing Qt can do against it. Qt is calling fsync() or fdatasync() when you call QSaveFile::flush() - what the OS does with this is out of Qt's scope.