title: getline startover
body: <p>I'm using the get line function in C to read through the lines of a file. I want to loop over the function so that I can read through the file n number of times. For some reason though, it only reads through it once (I think there's a pointer somewhere still pointing to the last line) at the beginning of the subsequent loops. How do I get it to reset?</p>
  
  <p>To make things clearer, if there were 100 lines in the file, below, the largest val would get would be 100 even though it should get up to 300. </p>
  
  <p>Thanks!</p>
  
  <pre><code>FILE* fp = myfopen (inf, "r");
  char* line = NULL;
  size_t len = 0;
  
  int num=3
  int val=0
  
  for (i=0;i&lt;num;i++)
  {
      while (getline (&amp;line, &amp;len, fp) != -1)
      {  
          val++;   
      }
  }
  </code></pre>