#include #include #define Diagrafi "******************" struct Foititis { char am[10]; char epi[20]; char ono[20]; float mo; }; main() { FILE *f; struct Foititis fo; char oa[50],x[10]; int c=0,flag; printf("\nDwse ton onoma tou arxeiou: "); gets(oa); f=fopen(oa,"r+b"); if(!f) { printf("\nTo arxeio %s den vrethike!",oa); return; } printf("\n Dwse ton AM tou foitith pros diagrafh:"); gets(x); flag=0; while (!feof(f) && flag==0) { fread(&fo,sizeof(struct Foititis),1,f); if (!feof(f)) { c++; if (strcmp(fo.am,x)==0) { printf("\nBrethike sthn thesi %d\n", c); flag=1; } } } if (flag==0) { printf("\nTo AM den vrethike!"); return; } strcpy(fo.epi,Diagrafi); fseek(f,-sizeof(struct Foititis),SEEK_CUR); fwrite(&fo,sizeof(struct Foititis),1,f); fclose(f); }