If I comment fprintf(pf,"1111");
the exe will crash and if I keep it,I get 2/3/2011 (only the first record).If I try to close the file the exe will crash too.
Is fscanf detecting the end of row as end of file and reads null?
I tried also close(*pf),it still crash.
fprintf should not be used in final code,I didn't mean to use it ,but when I used it I observed that the exe reads first line succesfully
Data* d;
fscanf(pf,"%d",&n);
d=calloc(n,sizeof(Data* ));
for(i=0;i<n;i++){
if(fscanf(pf,"%d/%d/%d",&(d[i].zi),&(d[i].luna),&(d[i].an))!=3) break;
printf("%d/%d/%d ",d[i].zi,d[i].luna,d[i].an);
// fprintf(pf,"1111"); with this I observed that first data can be read
}
fclose(pf);
input
3
2/3/2011
2/2/2012
2/2/2016