title: can't find what's wrong with the function fseek()
body: <p>I wrote this code and it seems there is a problem with the function fseek(). As it affects on the reading from the text file. It makes the function fscanf() reads something like garbage from the file and wrong data. My file contains just float numbers. </p>
  
  <pre><code>FILE *fptr;
  if ( !( fptr = fopen( "saving.txt", "r" ))){
      printf( "File could not be opened to retrieve your data from it.\n" );
  }
  else {
      fseek(fptr, 0, SEEK_END);
      unsigned long len = (unsigned long)ftell(fptr);
      if (len &gt; 0) {  //check if the file is not empty.
          while ( !feof( fptr ) ){
              fscanf( fptr,"%f\n", &amp;p.burst_time );
              //printf("time = %f\n",p.burst_time);
              AddProcess(&amp;l,p.burst_time);
          }
      }
      fclose( fptr );
  }
  </code></pre>
  
  <p>Hint: This part of code to know whether the file is empty or not. If not read from it. I also use the function rewind(fptr); before the loop, but there is no difference.Thanks in advance.</p>