I'm working on a project that requires files to be used only twice throughout the program–one time to load data in the beginning, and one time to save data at the end. The data is 3 arrays of structs, like a database of sorts. Here's their code.
struct patient {
string id;
string username;
string password;
string name;
int age;
} infoPatients[PATIENT_NUM];
struct doc {
string id;
string username;
string password;
string name;
} infoDocs[DOC_NUM];
struct appoint {
string index;
patient appointPatient;
doc appointDoc;
date appointDate;
string timeSlot;
}infoAppoints[APPOINT_NUM];
And this is the date struct:
struct date {
int day;
int month;
int year;
};
I think what I need to do is create 3 files, one for each struct array, and store 1 array element in each line. Each line will contain the struct members delimited by any delimiter character. But I have no idea what functions to use.
Apologies if this is a ridiculous question. Please feel free to redirect me to a similar question or any resource that will help me out, but if you could help me directly it would be much appreciated!