how to remove .ini file
-
To cite the documentation:
bq. Removes the setting key and any sub-settings of key.
Doen't sound like it takes a filename, does it?
And to read further:
bq. If key is an empty string, all keys in the current group() are removed.
So why not give
@
settings.remove("");
@a try?
-
If he wants to reset the stored values, then calling remove("") is equivalent to removing the file.
If removing the file is absolutely necessary, then one must be very careful to actually having a file to remove (do not remove the windows registry file...). And on a Mac it's different beast too. To actually remove the file, QFile::remove("path") is the way to go, that's right.
-
-
hello Scylla
Actually QFile::remove is working fine...but the thing is that when i change the address of my app its not working moreever when i build the application in the device its not working..so how can i do it so that whether i change the position or build in device it will remove the .ini file..
regards
Anshuman -
Hi Anshuman,
when the location of your ini-file is changing all the time, this is not what you typically want with QSettings.
Therefore you have in Windows the possibility to use the registry, but this is sometimes less handy, because it is basically one file with the whole (registry) information of your installation.You are using linux. In your example you have a fixed file name for your trial to remove the .ini-file. Check-out "QSettings":http://doc.qt.nokia.com/latest/qsettings.html#QSettings-4 . there you can use also a fixed name for opening the .ini-file. That is what you need anyhow. Changing locations of QSettings are not very helpful.