How can I read/write data file from phone
-
My application needs to read some configuration files(*.xml) from phone storage disk, how can I load them? I want to use relative file path like windows project,such as ./data/config ..
-
use QFile?
sorry for the stupid answer but you didn't even specify if you use QML or just widgets or whatever, but in the end you just use a QFile that works well on mobile platforms, the same ways as on desktop platforms!? -
Depending on what you need, this may be helpful
http://qt-project.org/doc/qt-5/QStandardPaths.html -
If you're targetting iOS:
-
I found https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html worth a read.
-
I've been putting files of all kinds (txt, qml, jpg) into my app bundle using the qmake support for doing that ( QMAKE_BUNDLE_DATA ) and have had no problem reading them using the usual Qt file tools (apps seem to start up with their CWD set in the bundle).
Haven't touched android myself.
-
-
Thanks for timday . I searched in website,and put my data files into sdcard .I set the data path as "./mnt/sdcard",that takes effects.