Marcus Stevens
2011-01-30 12:32:42 UTC
Implement your database as an array of structs of Bank Customer Record.
Which doesn't make any ******* sense to me but whatever.
I've never really done an in-memory database before so I'm a bit lost.
So to create and save the data, I used a struct and then just wrote the data to text files that I saved in a folder based on a sequential numbering system (the first created file was 0, then 1, 2, 3, etc), and to search the records it just opened the files and scanned the first two lines searching for a match to the name.
Because we also need to keep a log of transactions, I had four other files (one of them added a new line with information on a withdrawals, another on deposits, and a third that kept track of money transferred between accounts, and then a last on that changed a float every time there was a withdrawal or deposit).
Now, I think it will likely be a lot more complicated to do in-memory. So I'm hoping someone can link me to a tutorial on doing something like this, or explain part of it.
Can I set up a struct inside an array? How do I log and recall specific data, or run searches and whatnot of it all if it's not stored in a file? Would I need to make the entire thing in main() so that I can (can't use global variables, only constants)?
Am I even thinking of what it is right?