/* Function to read the data into structure array */

void read_data(struct student_struct student1[],int size)
{

FILE *fp;
char filename[40];
int i,j;

printf("Type in the file name:");
scanf("%s",filename);

fp = fopen(filename,"r");

for (i=0;i<size;i++)
{

   fscanf(fp,"%s",student1[i].name);
   fscanf(fp,"%d",&student1[i].status);
   fscanf(fp,"%d",&student1[i].hw);

      for (j=0;j<12;j++) 
          fscanf(fp,"%d",&student1[i].labs[j]);

      for (j=0;j<3;j++)
          fscanf(fp,"%d",&student1[i].progs[j]);

      for (j=0;j<2;j++)
          fscanf(fp,"%d",&student1[i].mids[j]);

   fscanf(fp,"%d",&student1[i].final);
}
fclose(fp);
}
