title: Reading line by line using fscanf
body: <p>I want to read a file with 3 lines:</p>
  
  <p>The first one with strings, second with a number and the third with strings again.</p>
  
  <p>Example:</p>
  
  <p>Line 1: bird toy book computer water</p>
  
  <p>Line 2:  2</p>
  
  <p>Line 3: toy water</p>
  
  <p>I have this code, that reads a file, word by word storing them in the word array, and then putting the word into the words 2d array. </p>
  
  <pre><code>char words [5][50];
  char word [50];
  int i,j;
  j = 0;
  
  while( (fscanf(file, "%s", word))!=EOF ){
      for(i = 0; i&lt;50; i++){
          if(word[i] != NULL){
              words[j][i] = word[i];
          } else{
              break;
          }
      }
      j++;
  
  }
  </code></pre>
  
  <p>it's working, but it reads all the lines, i want a way to just do this process for the first line, and then store the second line into a int variable and the third line into another 2d array. </p>