I have a file named DBFile.
I am using the following code:
QString DBfile ="C:/Users/E543925/Desktop/VikuTB.xml";
QFile newFile(DBfile);
newFile.open( QIODevice::WriteOnly);
Now I want to write something inside the file if it is empty.
How can I check whether a file is empty or not in Qt?
add the append flag and check the insertion
pointer:disclaimer: untested code, now i’ll take the time to try it…
edit: tested, seems to work well…