I tried taking the check variable entirely out of it. This is the part of the code I am having trouble with. It is giving me a segmentation fault.
Code:
while (fgets (line, sizeof line, fp ) != NULL) /*read a line*/
{
strcpy (arra[row], line) ;
row++;
}
/*split up rows into separate arrays*/
char codes [2000][4] ;
char names [2000][15] ;
char alts [2000][10];
char lats [2000][10] ;
char longis [2000][10] ;
char states [2000][2];
int character = 0 ;
char temp ;
row = 1 ;
for ( row = 1; row <2000 ; row ++)
while(arra[row][character++] != ',');
{
temp = arra [row][character] ;
codes [row][character ] = temp ;
}
while(arra[row][character++] != ',');
{
temp = arra [row][character] ;
names[row][character] = temp ;
}
while(arra[row][character++] != ',');
{
temp = arra [row][character] ;
states[row][character] = temp ;
}
while(arra[row][character++] != ',');
{
temp = arra [row][character] ;
lats[row][character] = temp ;
}
while(arra[row][character++] != ',');
{
temp = arra [row][character] ;
longis[row][character] = temp ;
}
while(arra[row][character++] != ',');
{
temp = arra [row][character] ;
alts[row][character] = temp ;
}
fclose(fp) ;