Results 1 to 4 of 4

Thread: Best place to store some textual files

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Best place to store some textual files

    Hello!

    I'm struggling with regarding a decision related to memory (both hard-disk and RAM) comsumption in a particular app of mine...

    I need to store some lines of data used in the execution of a particular dialog of mine, where some text and some images will be shown. The images shall be stored in the resource files, but I'm not sure what's the best way to store the textual file, containing both the paths to the images, the title and the description of each of my material.

    I see 3 viable options:

    *Store it in a txt file and put it in the resource file as well;
    *Store in a txt file and put it in the app's folder
    *Let the data be in the source code.

    I'm not sure which is the best option. As far as I know, to put the txt file in the base folder and read it as a normal text file not only gives the opportunity for having a missing file (in one that is particularly relevant to the application), but also has the disavantage of the slow operation of reading from the hard-disk. To put it in the resource file means less risk, but I don't know about improving in the speed of reading. Moreover, doesn't that increase any RAM comsumption or something else? (the size of the .exe file?) And regarding to put it in the source code, well I find it to be quite lame :P


    I'l welcome any advice will be welcomed

    Thanks,

    Momergil

  2. #2
    Join Date
    Jun 2008
    Location
    Rome, Italy
    Posts
    95
    Thanks
    19
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Best place to store some textual files

    Why don'you use an Sqlite database that has the :memory: solution too.

  3. #3
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Best place to store some textual files

    Momergil, what would you have done the size of the data is always the same and always data will be written to disk. How it really is size of the text data ? I have a feeling that you're looking for a problem where it does not.
    cydside how will the data be in the memory ? From the disk.

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Best place to store some textual files

    Quote Originally Posted by cydside View Post
    Why don'you use an Sqlite database that has the :memory: solution too.
    And how do you get the text in that database? The problems still exist: source code, resource or in file.

    There is no general answer to that question :-( It all depends on the size of the textfiles. If they are small, I would store them in the resource file. It is the easiest one and if you are on a Desktop machine, there is "no" measurable performance impact.

Similar Threads

  1. Android Installation - how and where to add/store changing user files?
    By sedi in forum Installation and Deployment
    Replies: 2
    Last Post: 13th June 2012, 16:58
  2. store and read mp3 files from buffer
    By vinayaka in forum Newbie
    Replies: 2
    Last Post: 2nd August 2011, 10:25
  3. Replies: 1
    Last Post: 1st December 2010, 06:13
  4. Replies: 12
    Last Post: 17th June 2009, 05:34
  5. Replies: 5
    Last Post: 8th April 2008, 23:10

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.