Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Input from text file error !!!
i have a strange problem here, my program must read and write in a text file...so i have added this file to resources..but it is not editable ..
...so any edit are done outside the program....and when i do this code
it does not work as my software don't find the specified file...this file is in a folder inside my qt program folder....any siggestions??!!!
[EDIT: fixed code formatting, Volker]
p-himik last edited by
As i know resources are read-only:
bq. The Qt resource system is a platform-independent mechanism for storing binary files in the application's executable. This is useful if your application always needs a certain set of files (icons, translation files, etc.) and you don't want to run the risk of losing the files.
If you want to edit some file you don't need to add it to your resources. You just need to create QFile with a path to that file. The path can be either relative or absolute.
so...if the file is in a folder called data in the software folder...what is the path??
i tried QFile file(/Data/filename) it don't work :S
vsorokin last edited by
@QFile file(qApp->applicationDirPath() + "/Data/filename")@
now i know where is the problem...thx vass :D:D