Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- struct date {
- int day, month, year;
- };
- struct student {
- int studentID;
- char firstName[20];
- char lastName[20];
- char courseID[10];
- int year;
- struct date registrationDate;
- struct date dateOfBirth;
- int averageGrade;
- };
- void main() {
- FILE* fpo;
- fpo = fopen("Output.txt", "r");
- char c;
- int count = 0;
- for (c = getc(fpo); c != EOF; c = getc(fpo))
- if (c == '\n')
- count = count + 1;
- printf("The file contains %d students\n ", count);
- struct student studentArray[100];
- static char buffer[1024];
- while (fgets(buffer, 1024, fpo) != NULL) {
- puts(buffer);
- }
- fclose(fpo);
- /*
- struct date registrationDate = { 27, 01, 2020 };
- struct date dateOfBirth = { 31, 01, 2000 };
- struct student s = {
- 123,
- "Gavin",
- "Guthrie",
- "AX250",
- 2002,
- registrationDate,
- dateOfBirth,
- 1
- };
- printf(s.year);
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement