Default mechanism to store information
-
Hi,
I need to store information to disk every time an app is used, a couple of lines, and I want the info to persist between each runs. Is there a better way than creating a file and writing to it?
Also, is the best location to create this file is in the same directory as the executable will reside? But how to know where the executable will reside ahead of time?
-
No, you should not write in installation directory! Usually your application will not have write access there!
Fot that kind of information you can use http://doc.qt.io/qt-5/qstandardpaths.html#writableLocation with QStandardPaths::AppLocalDataLocation as parameter to get the directory where your application should store such data. You should check at runtime whether this directory exists and create it if not.
See here for more details: http://doc.qt.io/qt-5/qstandardpaths.html