title: reading data from file in c
body: <p>I have a txt file named prob which contains:</p>
  
  <pre><code>  6 2 8 3
  4   98652
        914
  143   789
      1    
  527   146
   85      
   1 74   8
  7   6 3  
  </code></pre>
  
  <p>Each line has 9 chars and there are 9 lines. Since I cant make a string array in c, im be using a two dimensional array. Careful running the code, infinite loops are common and it prints weird output. Im also curious as to where does it stop taking in the string? until newline?
  expected result for each "save":   6 2 8 3
  or watever the line contained.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  FILE *prob;
  
  main()
  { 
      prob = fopen("prob.txt", "r");
  
      char grid_values[9][9];
      char save[9];
  
      int i;
      for (i = 0; (fscanf(prob, "%s", save) != EOF); i++)
      {
          int n;
          for (n = 0; n &lt;= 9; n++)
          {
              grid_values[i][n] = save[n];
              printf("%c", grid_values[i][n]);
          }
      }
      fclose(prob);
  }
  </code></pre>