title: Extra Line read from file
body: <p>I'm trying to read from a text file and store it into an array, but my last array is filled with garbage, is there any way to fix it? For reference, I don't need that last line of values, but I can't seem to find a way to get rid of it.</p>
  
  <pre><code>int k;
  char string[100];
  for(k = 0; k &lt; MAX_STATIONS; k++){
      if (fgets(string, sizeof(string), fp) == 0){
          break;
      }
      fscanf(fp,"%d %f %d %d %d %d %d %f %f", &amp;stationInfo[k].stationID, &amp;stationInfo[k].temperature, &amp;stationInfo[k].year, &amp;stationInfo[k].month, &amp;stationInfo[k].day, &amp;stationInfo[k].hour, &amp;stationInfo[k].minute, &amp;stationInfo[k].location.latitude, &amp;stationInfo[k].location.longitude);
      printf("%d %1.2f %d %d %d %d %d %f %f\n", stationInfo[k].stationID, stationInfo[k].temperature, stationInfo[k].year, stationInfo[k].month, stationInfo[k].day, stationInfo[k].hour, stationInfo[k].minute, stationInfo[k].location.latitude, stationInfo[k].location.longitude);
  }
  </code></pre>
  
  <p>EDIT: I've realized that using this method, I don't actually get the first line of my file read. How could I fix this?</p>