title: Cannot read my written file (C Programming Student Database)
body: <p>We got an assignment to make a program to read what is written inside our text file (name, student number, course, year, section, etc.. etc..) But I can't seem to make it work, can you tell me what's wrong?</p>
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;conio.h&gt;
  #include &lt;stdio.h&gt;
  
  struct record
  {
         char name[50],number[50],course[50],gender;
         int year, section;
         float midterm,final,average,sum;
  };
  
  int main()
  {
      int a=1,n;
      int passed=0,failed=0;
      
      FILE *fp;
      fp = fopen(&quot;BSU.txt&quot;,&quot;r&quot;);
      
      if(fp==NULL)
      {
             printf(&quot;ERROR!&quot;);
             getch();
      }
      
      struct record student[25];
      
      printf(&quot;Please input the number of students: &quot;);
      scanf(&quot;%d&quot;, &amp;n);
      
      for(a=0;a&lt;n;a++)
      {
            fscanf(fp, &quot;%f&quot;, student[a].average);// I CANNOT MAKE THE FSCANF WORK!!//
      }
      
      getch();        
  }
  </code></pre>