In the function nuevo_evento()
, of the latest program you posted, just change
fwrite(&event,sizeof(struct eventos),1,eve);
to
fwrite(event,sizeof(struct eventos),1,eve);
If you look at, the fwrite() function , the first parameter is the pointer to the data.
In your program , &event
is the address of the pointer itself , but event
is the address of the structure it is pointing to , and that is what you have to use with fwrite().
Also have a look at this question , it will be of help to the problem you are facing.