I'm reading in this file:
Code:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0
0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0
0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0
0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
And i need to output it to my image.coords[][] 2d array. For example image.coords[0][k] would all be 0. image.coords[1][1] should be 3. Here's my code to do so, why is it outputting all 0's? I've been looking at it for a while, and the longer I look at it, the farther away I get to figuring it out. I'm guessing its some simple little error, but i can't figure it out.
Code:
k = j = 0;
while( fgets(buffer, MAXLINE, in) )
{
k=i=0;
while(1)
{
while(!isspace(buffer[i]))
{
sscanf(buffer, "%d", &image.coords[j][k]);
k++;
i++;
}
while(isspace(buffer[i]))
{
i++;
}
if(buffer[i]=='\0')
{
break;
}
printf("%d ", image.coords[j][k]);
}
printf("\n");
j++;
}