title: Need help reading from a file and storing the contents into a 2d array
body: <p>I'm trying to read a file and store the contents into a 2D Array to make a chess board. The file has the position of the pieces (board state). I think everythings fine but run I run it the build crashes. I'm not getting error messages or what line is causing it so i'm not sure what went wrong.</p>
  
  <p>I tried using different scanf, and fgets methods, Finally I added a "show" method to see the board. I think this is crashing it.</p>
  
  <pre><code>int main(int argc, char** argv)
  
  { 
  FILE *in; //Create 2 file variables
  char line[50];
  int chessBoard[8][8];
  int turn = 0;
  in = fopen("board.csv","r");
  int true = 1;
  void show(int[][8]);
  if(in == NULL )
  {
      printf("The file specified couldn't be opened"
              "\nClose program and try again");
      true = 0;
      return 1;
  }
  else
  {
    fscanf(in, "%d", &amp;line);
        for (int i = 0; i &lt; 8; i++) 
        {
      for (int j = 0; j &lt; 8; j++)
          {
         fscanf(in, "%d", &amp;chessBoard[i][j]);
      }
         }
  }
  show(chessBoard);
  return 0;
  }
  
  void show(int chessBoard[8][8])
  {
      for(int row = 0; row &lt; 8; row++)
      {
          for(int col = 0; col&lt; 8; col++)
          {
              printf("%d",chessBoard[row][col]);
  
              if(chessBoard[row][col] &lt; 0)
              {
                  printf("    ");
              }
              else
              {
                  printf("    ");
              }
              if(col != 7)
              {
                  printf("|");
              }
              printf("\n");
          }
      }
  </code></pre>
  
  <p>its supposed to print out the board state, but when I run it I get "run failed".</p>