fscanf for multi dimensional arrays
i am trying to take a line from a text file using fscanf
the textfile looks like this:
before and after % whiteny houston texas
on the map % Lake Arrowhead California
(etc for 46 lines)
Code:
FILE *inp;
inp = (FILE *) fopen("clues.txt", "r");
int row, column;
char clue[row][column]
for(row = 0; row <= 46; ++row)
{
for(column = 0; column <= 60; ++column)
{
fscanf(inp, "%s", &clue[i]);
}
}
printf("%s", *clue);
}
We need to get each line into a seperate line of the array right now it only prints one word and seems to only be putting one word from a random line into the array.