alright so each line of txt was changed whereby:
Ball David 52000 Tucson
Doe Oscar 12225.89 Tucson Phoenix
Talley Stephen 181250.50 Seattle Tacoma
insert
Code:
FILE *fpx;
fpx = fopen("salesData", "r");
if (fpx==NULL) {
printf("File not Opened!\n");
return(0);
}
for (i=0; i<MAX; ++i) {
fscanf(fpx, "%s %s %lf %s %s %s", lastname[i], firstname[i], &digits[i], city1[i], city2[i], city3[i]);
}
fclose(fpx);
i kinda understand your concept of a 1D array, yet how would that work for the character arrays, givin a MAX number of lines, each holding 15 characters.
with the code above...if one line only has 1 city, the other cities start scanning the next line!
THUS: How do you get the 'for' loop to terminate after that line has no more cities or reaches the max amount of 3 cities?????