What wrong with the following code? I am trying to read two text files into an array, one text file into each column (2 columns and two text files in total) It runs, however once its finished it crashes?
Code:
file = fopen("C:\T0.txt", "r");
i = 0;
while (!feof(file)) {
/* loop through and store the numbers into the array */
fscanf(file, "%f\t", &init_T[i][0]);
i++;
}
file = fopen("C:\theta_f.txt", "r");
i = 0;
while (!feof(file)) {
/* loop through and store the numbers into the array */
fscanf(file, "%f\t", &init_T[i][1]);
i++;
}
for (i = 0; i <= num_inputs; i++)//Convert to radians
{
init_T[i][1] = init_T[i][1]*2*pi;
}
for (i = 0; i <= num_inputs; i++)
{
printf("%f %f\n",init_T[i][0],init_T[i][1]);
}
according to the debugger, the error occurs on the 'while' line of the second while loop - the one reading from theta_f.txt