Problems putting a text file into a matrix.
Im trying to create the "game of life" but thus far have found great problems trying to input a text document into a matrix. Iv been trying to find a tutorial on the internet but none seem to answer the question, all i find is how to create an array or how to use a pointer.My code is as follows and is currently incomplete to run the program as I dont want the program written for me as its for my degree, I simply wish to know how to put the file "ref"(which comprises 1000, 1s or 0s) into the array "matrix"(10*10).
Code:
#include <stdio.h>
int main()
{
int row, column;
FILE *game;
int *reference_ptr;
game = fopen ("ref.txt", "r");
if (game == NULL)
{
printf ("File could not be opened\n");
}
else
{
printf ("File opened! Closing it now...\n");
fclose (game);
}
reference_ptr=&game;
int matrix[10][10] =
{
*reference_ptr
};
}
I get the returned error:"0019 ERROR:An object of type '<ptr><ptr>_file' cannot be assigned to an object of type '<ptr>int'"