like i said before i don't know what a code tag is....
this it?
TotalLodgements()
{
FILE *fp;
long total=0;
long previous=0;
if((fp = fopen("CLIENT---INFO.dat", "rb")) == NULL)
{
printf("\nError opening file\n\nPLEASE CONTACT CUSTOMER SERVICE AT A3 SOLUTIONS TO RESOLVE THIS PROBLEM\n");
exit(1);
}
system("cls");
while(!feof(fp))
{
fread(&newinfo, sizeof(struct client),1,fp);
printf("\n%ld",newinfo.AmtLodged);
if(previous!= newinfo.AmtLodged)
{
total=total+newinfo.AmtLodged;
}
previous = newinfo.AmtLodged;
}
time_t now;
time(&now);
printf("\nTotal Lodged as at %s : %d", ctime(&now), total); /* Print total to date */
fclose(fp); /* Close the file */
printf("\n\n");
system("pause");
system("cls");
MainMenu();
}
1000
123
1234
1234