take two loop one is for row means end of file and other is for column means end of line...
and skip white space(according to your text file)...
for i=0 to EOF
for j=0 to EOL
Skip according to your file which character you have to skip menas like white space
Mat[i][j]= read contents by file Pointer