title: Reading two matrices from one txt file
body: <p>I'm having trouble with one task.</p>
  
  <p>I need to read two matrices from a text file and multiply them together.</p>
  
  <p>The problem is that I know how to read one matrix but I don't understand how to read the two matrices separated   (for example)  by two spaces in a file.</p>
  
  <p>Matrix.txt:</p>
  
  <pre><code>1 2 3  1 2 3
  4 5 6  4 5 6
  7 8 9  7 8 9
  </code></pre>
  
  <p>Maybe someone could explain me how to do that.</p>
  
  <p>Now i'm trying to read first matrix:</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  
  int main(){
  FILE *fp;
  int eSk = 0, sSk = 0,
  matrix1[10][10] = {0}, i, j;
  char c;
  fp = fopen("matrix.txt", "r+");
  while(!feof(fp)) {
      while(getc(fp) != ' ') {
           fscanf(fp, "%d", &amp;matrix1[eSk][sSk]);
           sSk++;
      }
      eSk++;
  }
  
  for(i = 0; i &lt; eSk; i++) {
        for(j = 0; j &lt; sSk; j++) {
              printf("%d ", matrix1[eSk][sSk]);
        }
        printf("\n");
  }
  
  puts("");
  
  system("pause");
  return 0;
  }
  </code></pre>
  
  <p>what's wrong ?</p>
  
  <p>Thank you for any help. </p>