In quite a few places, you are using the MAIL or the MAILR structure as if it is a variable, when it is not.
For example, in leficheiro.c, the lines 13-17, you use this following code:
Code:
fgets("MAILR[i].to",120,fp);
fgets("MAILR[i].from",120,fp);
fgets("MAILR[i].sub",120,fp);
fgets("MAILR[i].msg",120,fp);
fgets("MAILR[i].spc",120,fp);
Where it SHOULD be using the ptr variable. Also, when using variables, you don't put them inside quotes as you have. The compilable, working code should look like this:
Code:
fgets(ptr[i].mail.to,120,fp);
fgets(ptr[i].mail.from,120,fp);
fgets(ptr[i].mail.sub,120,fp);
fgets(ptr[i].mail.msg,120,fp);
I got rid of the .spc value in there as I didn't find an spc variable anywhere....
But that is basically your problem, that same thing occurs elsewhere in the program, you just need to remember to get rid of the quotes and make sure you are pointing to the correct values.
MAILR is an array of MAIL, therefor any MAILR variable should look like so:
Code:
MAILR variable;
variable[0].mail.<place variable here>
That is rough pseudocode, but you should see what I mean.
Also, you do not need to pass a pointer to a MAILR variable, as I noticed you do in one of the functions you use MAILR[] which isn't necessary, as the MAILR structure is already declared as an array, which in itself is a pointer. So it's best to remove the [] and also the MAILR *ptr in the declaration of the function.
Hopefully this clears a bit up, I have a working, compileable version of the code, but I want to see if you can fix it yourself.