PDA

View Full Version : adding files to resources by code



Malisha100ka
11th January 2015, 17:00
Hi,

Is there any way to add files (text ones) to recources by the code?
When i'm saying adding i mean creating new txt file in resources location, and than write and read from it...

if is posible pls example or method how to...

Thanks :)

wysota
11th January 2015, 17:43
You cannot modify a resource while the application is executing (if that is what you are asking) as the resource is compiled into the application binary. What exactly do you need it for?

Malisha100ka
11th January 2015, 17:52
thanks for reply,

I whanna make application that allows u to save some texts which would be only editable and readable by the same program...
i don't whant to have folder full of .txt files

soo what should i use than?

i thought resources were made for that :/

d_stranz
11th January 2015, 19:36
i thought resources were made for that :/

Resources are generally used to contain files that you (the developer) add to the project. Things like image files for icons, for example. They are compiled into the executable so you don't have to ship the images files along with the app.

Why don't you look at QSettings - this is intended to do exactly what you are describing, creating a text file of parameters or options used by a program to customize it to a user's needs.

wysota
11th January 2015, 23:45
Alternatively a simple sqlite database can be used to store data in a single blob that accompanies the program.

anda_skoa
12th January 2015, 08:33
Even with text files there should be no problem.
All moderns operating systems have application specific data locations, i.e. a folder for each app that it can store its data into.

Cheers,
_