I'm loading a 2D array with information from a file. The array loads the data properly; however, locations 9, 10, 12, 13, 17,18, and 19 are not recognized as characters, but the characters print correctly.
File content:
Program:
I'm very lost on why only a few characters are not recognized as characters. Actually they are not recognized as anything (digit, punctuation, etc.)
Any help is greatly appreciated!
Drew
File content:
Code:
A 232 1150 1302 0 25 150 325 1 10 2006 10 20
B 232 1150 1302 0 25 150 325 1 10 2006 10 20
C 232 1150 1302 0 25 150 325 1 10 2006 10 20
D 232 1150 1302 0 25 150 325 1 10 2006 10 20
E 232 1150 1302 0 25 150 325 1 10 2006 10 20
F 232 1150 1302 0 25 150 325 1 10 2006 10 20
G 232 1150 1302 0 25 150 325 1 10 2006 10 20
H 232 1150 1302 0 25 150 325 1 10 2006 10 20
I 232 1150 1302 0 25 150 325 1 10 2006 10 20
J 232 1150 1302 0 25 150 325 1 10 2006 10 20
K 232 1150 1302 0 25 150 325 1 10 2006 10 20
L 232 1150 1302 0 25 150 325 1 10 2006 10 20
M 232 1150 1302 0 25 150 325 1 10 2006 10 20
N 232 1150 1302 0 25 150 325 1 10 2006 10 20
O 232 1150 1302 0 25 150 325 1 10 2006 10 20
P 232 1150 1302 0 25 150 325 1 10 2006 10 20
Q 232 1150 1302 0 25 150 325 1 10 2006 10 20
R 232 1150 1302 0 25 150 325 1 10 2006 10 20
S 232 1150 1302 0 25 150 325 1 10 2006 10 20
T 232 1150 1302 0 25 150 325 1 10 2006 10 20
Program:
Code:
#include <stdio.h>
#include <ctype.h>
int LoadFlightInfo(int flight[13][20]);
int main(void)
{
int flight[13][20];
LoadFlightInfo(flight);
return 0;
}
// LoadFlightInfo
// Inputs: flight array
// Outputs: flight array
int LoadFlightInfo(int flight[13][20])
{
int i, a;
char temp;
FILE *FlightInfo;
FlightInfo = fopen("lab1input.dat", "r");
for(i=0;i<20;i++)
{
fscanf(FlightInfo, "%c%d%d%d%d%d%d%d%d%d%d%d%d", &flight[0][i], &flight[1][i], &flight[2][i], &flight[3][i], &flight[4][i], &flight[5][i], &flight[6][i], &flight[7][i], &flight[8][i], &flight[9][i], &flight[10][i], &flight[11][i], &flight[12][i]);
fscanf(FlightInfo, "%c", &temp); // removes next line as character
a = isalpha(flight[0][i]);
printf("\ni = %d, %c, alpha = %d, temp = %c", i, flight[0][i], a, temp);
}
fclose(FlightInfo);
return flight[13][20];
} // End LoadFlightInfo Function
I'm very lost on why only a few characters are not recognized as characters. Actually they are not recognized as anything (digit, punctuation, etc.)
Any help is greatly appreciated!
Drew