#include <stdio.h> #include <stdlib.h> #include <process.h> struct inforec { char name[85]; int age; }; int main() { char ch, filename[85]; FILE *fileptr; int recnumb = 1; struct inforec person; printf(”Anna Tiedoston nimi\n”); gets(filename); if ((fileptr = fopen(filename,”r”)) == NULL) { printf(”Tiedostoa ei voi avata”); exit (0); } while(fread(&person, sizeof(person), 1, fileptr) == 1) { printf(”Tietue # %d\n”, recnumb++); printf(”Nimi on %s\n”, person.name); printf(”Ikä on %d\n”, person.age); printf(”Paina Enteriä siirtyäksesi seuraavaan tietueeseen\n”); ch = getchar(); } fclose(fileptr); printf(”Tiedoston loppu”); return 0; }