Hey everyone. Glad to become part of this community and I hope I continue to come here for a long time seeing as this site gives great helps. My problem:
I have a struct that is (for example) the following:
#define NUM 999
struct client
{
int id;
char name[15];
char lastname[15];
int telephone;
}c[NUM];
I want to do the following: First I want to see if the file exists or not. Thats pretty simple using a pointer to the fopen function with the file; If it returns NULL it doesnt exist. Now the hard part is reading and loading and then after saving.
If it isnt found, all the struct will be set to the number/string 0. If its found, then all of the data from the text file is loaded onto the struct and I work with the struct modifing, deleteing, adding, etc.
At the end of the program when I hit enter, Id like for the program to save all (or the changes) to the text file so when I load the program again it has all the additions I previously made.
If Im not clear on something, go ahead and ask. Thank you very much for your help.