Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Default mechanism to store information

Default mechanism to store information

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 773 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M Offline
        M Offline
        michelson
        wrote on last edited by michelson
        #3

        You can try QSettingsas well .

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved