If you want to read in a matrix you need some considerations.
First of all you need some cind of datastructure to have the data in some datatype.
A int** would be very suitable.
But you need to know the dimesions,
you will get the number of columns after the first line,
but you need to loop through the entire row to get the number of lines.
So either make some "dynamic" datastructure, or just read the file 2 times.
It doesn't look like you are allocating any memory in your code snippet.