storing the data ?

Hello there,
I am tring to teatch myself to program in c++ and by now I am not an absolute novice, but I still have got a massive gaps, obviosly. Here is my question. I have in mind a simple software, that would run with FLTK graphic interface. I have in mind very simple desing. Couple of inboxes an outboxes. Let me actually describe it in a bit more detail. It would be a calender. I want to be able to clik between the months. For every month I would display list of dates at the top half of a window a then once I would click on the day, I could at to bottom half insert a data for the day. Like how many hours I worked for example and it would calculate how mouch money I made that day and another simple data imput. Now here is my question. How should I store the data. Should I just output all the data for every day in to a simple txt file and have a file for every day of a year, or should I keep it in one file. Should I load all the data for every month once I start the program and output then before exiting program?
Im sory, Im loosing my train of thoughts. What Im tring to say is, has anybody got an advise how to store data in simple programs like the one I badly described above ? Every advise is much apprechiated.
thank you.
It's conventional to use a database. I wouldn't recomend writing your own file unless there's a compelling reason to. There are a few small/light ones around.

I like sqlite http://www.sqlite.org/quickstart.html for little things like this. It runs inprocess and the database can be manipulated by standard external tools and understands SQL.

There's BerkeleyDB which I persevered with for some years, but it's owned by Oracle now. It's thought to be unreliable across network file systems.
I agree, a database is very approperiate here. You will thank yourself later when doing reporting. Getting totals and such over periods of time are much easier to calculate with an SQL query versus writing the code for the report. Not to mention it would be much faster.
Last edited on
Alrigth, thank you for your help guys
Topic archived. No new replies allowed.