best way to store options? (memory and harddisk at the same time)

This is a discussion on best way to store options? (memory and harddisk at the same time) within the C++ Programming forums, part of the General Programming Boards category; I am going to write a lightweight appointment manager. First just as console app as practice. Therefore I need to ...

  1. #1
    Registered User
    Join Date
    Jul 2007
    Posts
    88

    best way to store options? (memory and harddisk at the same time)

    I am going to write a lightweight appointment manager. First just as console app as practice.

    Therefore I need to load some variables on program start from harddisk and store them in variables. The content of the variabels may change and this should be corrected on harddisk then too. Them might be also deleted.

    Any program which stores any settings works on that way. My question is now is there already some external library for all that? Some programs seam to user either windows registry (not portable), xml or ini.

    I "just" need a variable which will be also stored to the disk. Any advice?

  2. #2
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    look at boost program options library. it's very easy to handle options given per command line or file with it.

    http://www.boost.org/doc/html/program_options.html

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If you only have a few appointments, you could simply store them in a plain text-file with your own format, such as:
    Code:
    2007-09-12 10:30 11:00 Meeting to discusss the appointment project
    2007-09-12 12:00-13:00 Lunch with my wife
    ... 
    2007-12-20 18:00-01:30 Office Christmas party.
    If the file is small enough, the time to parse, load and save, etc, will be sufficiently short that it's of no issue.

    Obviously, if you are doing an application for appointments to support a large organization (more than a dozen or so), a single textfile isn't useful, and storing large number of text-files will also be rather inefficient. In this case, a REAL database is needed. It doesn't have to be an SQL database, but certainly something using index tables and balanced trees or such.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What's the best memory (RAM) type?
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 12-14-2001, 11:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21