Hi All,
I am tring to using the below function to read in a .txt file, which consist of a 10x10 matrix number.
I just cannot find out where goes wrong, it appears such a funny number -858993460...
void readinput(int in[][MAXCOLS])
{
int row ,col,ip; //Declare row,col, ip as int type
inputFile=fopen("MatrixA.txt","r"); /*Open MatA.txt for reading*/
fscanf(inputFile,"%d\n"); /*unuse integer*/
fscanf(inputFile,"%d\n"); /*unuse integer*/
for(row=0; row<MAXROWS; row++) /* to keep on reading every number */
{
for(col=0; col<MAXCOLS; col++)
{
fscanf(inputFile,"%d",&ip);
fscanf(inputFile," ");
in[row][col]=ip;
}
}
return; /*Empty return*/
fclose(inputFile); /*Close the file stream*/
}