title: How to read a file until a character in C
body: <p>So I have this input file:</p>
  
  <pre><code>1 2 3 4 5 6 7
  3 2 4 1 6 5 7
  ***
  1 1 2
  1 1 2
  ***end of input***
  </code></pre>
  
  <p>I want to scan the first two lines of integers, then something with them, then skip the <code>*</code> and scan the next lines of integers, and do something with them as well (like a loop until it reads <code>*</code>).</p>
  
  <p>How could I do that? Here's my code:</p>
  
  <pre><code>int main(){
  int i = 0, j ;
  int temp[100];
  char c, buf[20];
  FILE *fp;
  fp = fopen("input.txt", "r");
      if (fp != NULL){
  
              while (1 == fscanf(fp, "%d ", &amp;temp[i])){
                  i++;
              }   
                              // do something with the integers
      }
      else{
          printf("Cannot open File!\n");   
      }
  
  return 0;
  }
  </code></pre>
  
  <p>So the problem is, I can only scan the first two lines of integers. I want to scan the integers after the <code>*</code> as well.</p>