I am having a problem with reading input data after checking a position marker in the data file. The code that does the reading follows:
fip = fopen("fprmf.txt","r");
.
.
.
strcpy(passw,"P7");
fscanf(fip, "%3s", ckod); /* card # 164 */
fprintf(ff16,"\n\n%12s%12s\n", "card# 164 :", "Password ");
printf("passwd is %s\n", ckod);
if(strcmp(passw,ckod)!=0)
{
printf("\n%64s\n%80s\n", "E R R O R !", "Password is incorrect. Please resubmit.");
exit(164);
}
/***** Cards 165 - 174 *****/
fprintf(ff16, "\nLIST OF SOLVENCY SURCHARGE RATES\n");
fscanf(fip, "%5.3f", &solvpctchkinitial);
fscanf(fip, "%5.3f", &solvpctchkmaximum);
fprintf(ff16, "INITIAL PERCENTAGE = %5.3f, MAXIMUM PERCENTAGE = %5.3f\n", solvpctchkinitial, solvpctchkmaximum);
surchargeCheckPercent = solvpctchkinitial;
for(i=1;i<=18; i++)
{
fscanf(fip, "%5.3f",&solvsurchgrt[i-1]);
fprintf(ff16, "\n SOLVENCY SURCHARGE RATE = %5.3f\n", solvsurchgrt[i-1]);
}
fprintf(ff16, "\n");
puts("Finish executing inrate.");
The data that it reads is:
P7
0.005 0.007
3.200 2.850 2.650 2.450 2.250 2.150 2.100 2.000 1.900
1.800 1.750 1.600 1.500 1.400 1.350 1.300 1.200 1.100
The code calls the P7 a "password", but it is a position marker in the file so the programmer can determine where the data is read and where to put new data.
What I get in the output is:
passwd is P7
and then:
LIST OF SOLVENCY SURCHARGE RATES
INITIAL PERCENTAGE = 0.000, MAXIMUM PERCENTAGE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
SOLVENCY SURCHARGE RATE = 0.000
I have looked at how the data file is buildt, and there is nothing incorrect in the data. I do not know what more to look at to resolve this issue. Any help is greatly appreciated.