Basically this is the code ive used to pull the information from the file so that it writes all the records to the screen, that are in the text file.Code:void ld_apps() { FILE *fp; fp = fopen("G:/Uniwork/Semester2/ProceduralProgramming/Assignment/Appointment.txt", "rt"); if (fp == NULL) { printf("\nUnable to Open Input File\n"); exit(EXIT_FAILURE); } else { printf("File Open\n\n The Appointments are Shown Below\n\n"); } while ( !feof ( fp )) { Appointments++ ; printf("\n\nCurrent Number of Appointments: %d", Appointments); { fscanf(fp, "%s", PrAppArray[0].name); printf("\nName: %s", PrAppArray[0].name); fscanf(fp, "%s", PrAppArray[0].surname); printf("\nSurname: %s", PrAppArray[0].surname); fscanf(fp, "%f", &PrAppArray[0].starttime); printf("\nStart Time: %.2f", PrAppArray[0].starttime); fscanf(fp, "%f", &PrAppArray[0].endtime); printf("\nEnd Time: %.2f", PrAppArray[0].endtime); fscanf(fp, "%s", PrAppArray[0].place); printf("\nPlace: %s", PrAppArray[0].place); fscanf(fp, "%s", PrAppArray[0].whom); printf("\nWhom: %s", PrAppArray[0].whom); fscanf(fp, "%s", PrAppArray[0].date); printf("\nPlace: %s", PrAppArray[0].date); fscanf(fp, "%s", &PrAppArray[0].priority); printf("\nPriority: %s", PrAppArray[0].priority); } } printf("\n"); subm_app(); return; } // finish function
but when it does, it prints every record twice, very frustrating.
could anyone please help?
i also have the code also which writes the information into the file, if its needed please say.



LinkBack URL
About LinkBacks



