Basking got caught by the TGML processor which wiped out his 's -- I added a little more detail to it his code as well:
#define NUM_ROWS 3
#define NUM_COLS 2
...
int i=0;
int arr[NUM_ROWS][NUM_COLS];
while(i<NUM_COLS && !feof(fileptr))
{
/* check here to make sure fscanf agrees with us */
if (fscanf(fileptr, "%d %d", &arr[0], &arr[1])!=NUM_COLS) {
fprintf(stderr,"Bad file\n"
break;
}
++i;
}
This is a naive implementation (the array is of a fixed size, limiting the # of columns and rows allowed) but since you didn't provide very much information on what you want to do, it's probably better left that way.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.