Printing data from a file

Hello! I copied data from a structure into a file, but I am having trouble figuring out how to print the date from a file, since I can't just create a for loop to go through all the various structions! Here is the file to print it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
  void display(emp * emp1, int n)
{
   pRead = fopen("people.dat", "r");
   if(pRead==NULL)
     printf("\nFile can't be opened.\n");
   else
     {
      printf("\nContents of Phonebook\n\n");
      
      while( !feof(pRead)
        {
          fscanf(pRead, "%s\t %s\t %s\t %s\t %s\n", emp1[s].fname, emp1[s].lname, emp1[s].addr, emp1[s].phonum, emp1[s].email);
        }
     }
  
}
Topic archived. No new replies allowed.