I have the following code that is giving me a Huge problem, and cant seem to figure out why.
I stored some information to a file and i want to read it out back but it keeps on reading out 9 variables instead of the 14 and i dont know why.
Reading out code ( i have left out some of the code as to keep it short)
int FindInfo(FILE *fp,Ca_Info *emp,int regnum,int upd)
{
int tempreg,choice;
Ca_Info tempstr;
trans temptstr;
int hm;
if (regnum>1000)
{
tempreg=regnum;
while (1)
{
hm=fscanf(fp,"%s %d %d %s %d %s %d %s %d %d %f %f %s %s",temptstr.transnum,&tempstr.regnum,&temptstr.d_Lic,temptstr.c_Nme,&temptstr.dte.DD,temptstr.dte.sls,&temptstr.dte.MM,temptstr.dte.sls1,&temptstr.dte.YY,&temptstr.time,&temptstr.ins_Cost,&temptstr.rnt_Cost,temptstr.cre_Crd,tempstr.status);
if(feof(fp))
{
return 1;
}
if((atoi(temptstr.transnum)-regnum)==0)
{
return 0;
}
else
{
return 1;
}
}
}
Code was written in this format:
strcpy(rting.status,"Out");
fflush(rfp);
fprintf(rfp,"%s %d %d %s %d%s%d%s%d %d %.2f %f %s %s\n",ruc.transnum,rting.regnum,ruc.d_Lic,ruc.c_Nme,ruc.dte.DD,ruc.dte.sls,ruc.dte.MM,ruc.dte.sls1,ruc.dte.YY,ruc.time,ruc.ins_Cost,ruc.rnt_Cost,ruc.cre_Crd,rting.status);
regch=rting.regnum;
Update(regch);
fclose(rfp);
fclose(verfp);
This is the ouput in file when printed
174094 1 123456 Alec 12//8//2014 20 400.00 600.000000 2222222 Out