Small Function problem. Would appreciate any help given. <3
Hey there. I have a file function that is not working correctly and am a bit stumped by it. I'd appreciate any help.
Function prototype:
Code:
void SaveFile(student list[], FILE *database);
Function definition:
Code:
void SaveFile(student list[], FILE *database)
{
database = fopen("database.txt","w"); //Here I am trying to connect to the file and have it create a file
SaveFile(list, database); //then the program prints the list to the file
fclose(database);//and then closes the file
}
Function call:
Code:
SaveFile(list, &database);
Every time I set up the function call the program will not execute properly. It terminates and errors half way through the execution. Help? Thank you.
And I do have the File defined.