Well, one easy way to resolve this would be to save additional information in another file. Let's say we define two struct: one being the type you want the ID to be, and the other being a a "IDGenerator" type.
You could think implementing functionality for...
typedef unsigned int TypeID;
- Returning a unique ID
- Reseting the ID generator to 0
- Loading ID information from a FILE
- Saving ID information to a FILE
Here's what the function prototype could looks like (note that there is different way to do so):
This is just an idea on how it could be done. This would be rather straighforward to implement. And won't be complicated to use. If you have additional question, ask.
/* Return a unique ID */
IDGenerator giveUniqueID(IDGenerator i, TypeID *newID);
/* Reset IDGenerator */
/* Load IDGenerator information from a file */
IDGenerator loadIDGenerator(FILE *file);
/* Save IDGenerator information to a file */
void saveIDGenerator(IDGenerator i, FILE *file);