Dynamic Array Of Structures - Often Changing - HOW?
Hi All,
I need to code processing of files in C - That part is easy.
The content of these files is linked, so I need to hold the record data that I read from one file until I get some more information relating to that record, or get an end record for it, which will be in another, later, file.
I was thinking dynamic array of structure, which works in principle, but I'm not sure about removing only some of the data - I don't know that it's possible?
I want to hold the information in memory, appending new information, and only get rid of the allocated memory for a particular instance of my data once I receive an end record for it, write it away and free memory, retaining structures for all the other records.
I guess the easiest way to explain it is to say it's like a restaurant order (in processing, but the data is a structure).
table 1 orders some drinks
table 3 orders some drinks
table 2 orders some drinks
table 1 orders starters
table 3 orders mains
table 1 orders mains
table 2 orders starters
table 2 orders mains
table 3 orders desert
table 3 requests bill **
table 2 orders desert
table 1 orders coffee
table 2 requests bill **
table 1 requests bill **
Requesting bill signifies the end of keeping information on that table, so output and get rid of anything to do with that particular table.
Assume my restaurant is big - It has 100000 tables !!!!
Any help on what is best to use would be appreciated.
Many Thanks