i've been stuck on this for a while, and i've tried a variety of things, most of them resulting in segfaults. i basically want to increment my variable "count" each time there's a new line in the file.
please ignore my use of feof for now. i'll fix that later to make it EOF.
sorry about how the orange came out in terms of indentation( the printf). it copied over weird and wouldn't let me fix it.
#define DIM 1000
int main(int argc, char *argv)
data student[DIM]; /*array of structs*/
int count = 0; /*number of students*/
database = fopen(argv,"r");
printf("Welcome to the Student Database \n");
printf("First Last ID GPA \n");
for(i = 0; i < DIM; i++)
fscanf(database,"%s %s %d %f \n",student[i].firstname,
/* if(fscanf(database,"%s %s %d %f \n",student[i].firstname,
student[i].lastname,&student[i].ID,&student[i].GPA) == '\n')
for(i = 0; i < count; i++)
printf("%-12s %-12s %-12d %-12.2f \n",student[i].firstname, student[i].lastname,
"student_functions.h" is a header file that, for now, only defines my struct.
so i know that if i have the count++ where it's green, it will give me a result of 1000. if it's where the color is red, it will be 1, and the blue is 0.