I dont understand the connection between stdin and fscanf
struct musteri{
int no;
char name[40];
char surname[25];
double arrear;
};
int main() {
struct musteri hesapBilgi={0,"","",0.0};
FILE *ptr;
if((ptr=fopen("eleman.txt","r+"))==NULL){
printf("error");
}
else{
printf("\n enter a no if you want exit enter 0 -->");
scanf("%d",&hesapBilgi.no);
scanf take a input and put the no in sturct musteri
while(hesapBilgi.hesapno !=0){
printf("enter a surname name and arrear --->");
fscanf(stdin,"%s%s%lf",hesapBilgi.surname,hesapBilgi.name,&hesapBilgi.arrear);
in here does the fscanf reading from data in file ? or Something else is going on?
fseek(ptr,(hesapBilgi.no-1)*,sizeof(struct musteri),SEEK_SET);
what is fseek doing ?
fwrite(&hesapBilgi,sizeof(struct musteri),1,ptr);
printf("enter a no :");
scanf("%d",&hesapBilgi.no);
}
fclose(ptr);
}
return 0;
}