Computing.Net > Forums > Programming > read a File to aMatrix in C

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

read a File to aMatrix in C

Reply to Message Icon

Name: bly_h
Date: July 29, 2003 at 02:42:24 Pacific
OS: Linux
CPU/Ram: 700
Comment:

I write this Funktion to read a ASCII FILE to a Matrix.didnīt work why?

IntMatrix* load_matrix(FILE* fileIn)
{
IntMatrix* matrix = NULL;
int cols = 0;
int rows = 0;
int i, j;
if(fileIn && fscanf(fileIn, "%d,%d\n",&cols,&rows)){
matrix = new_matrix( cols, rows);
for(i=0;imatrix[i][j]));
}
}
if(i cols || j rows){
delectMatrix(matrix);
matrix = NULL;
}
}

return matrix;

}



Sponsored Link
Ads by Google

Response Number 1
Name: igork
Date: July 29, 2003 at 04:15:47 Pacific
Reply:

Hi again ;-)
I think there is some bug in this site since
it ommits statements in your code...
If u want, u can email me your code to
igork@zoran.co.il
I`ll try to help u.


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: read a File to aMatrix in C

read file from subroutine in c++ www.computing.net/answers/programming/read-file-from-subroutine-in-c/3714.html

scanning a word and strcmp in C www.computing.net/answers/programming/scanning-a-word-and-strcmp-in-c/13333.html

writng files to folder in C++ www.computing.net/answers/programming/writng-files-to-folder-in-c/3485.html