title: How to read a multi line using fscanf
body: <p>I want to read my data.txt file which looks like and store it in an array called buffer[i][j]</p>
  
  <p>1 1 1 1</p>
  
  <p>2 2 2 2</p>
  
  <p>3 3 3 3</p>
  
  <p>4 4 4 4</p>
  
  <p>I am writing a code which looks like</p>
  
  <pre><code>#include"stdio.h"
  #include"stdlib.h"
  
  int main() {
  
    FILE *fp1;
    int i,j;
  
    int buffer[4][4]={0};
  
    fp1 = fopen("exact_enumerated_config_442_cub_mc","r");
  
    for(i=0;i&lt;4;i++) {
      for(j=0;j&lt;4;j++) {
        fscanf(fp1,"%d", &amp;buffer[i][j]);
      }
      // fscanf(fp1,"\n");
    }
    fclose(fp1);
  
    for(i=0;i&lt;4;i++) {
      for(j=0;j&lt;4;j++) {
        printf("%d ",buffer[i][j]);
      }
      printf("\n");
    }
  }
  </code></pre>
  
  <p>but i get the output...</p>
  
  <p>1 1 2 1 </p>
  
  <p>5 1 6 1</p>
  
  <p>17 1 18 1</p>
  
  <p>21 1 22 1 </p>
  
  <p>why????</p>