So -- shocking idea here -- you could take the core of that function:
Code:
for(i=0;i<num;i++)
{
printf("\nName:%s", list[i].name);
printf("\nGPA:%lf", list[i].gpa);
printf("\nID: %d\n", list[i].id);
}
-- change the printf to fprintf, and you're in like Flynn.
If you wanted to do things properly, I suppose you could modify your display function to take another parameter of "where to print" -- to print to the display you pass in stdin, and to print to a file you pass in your opened FILE*. (stdin is also a FILE*, so it works.)