This is supposed to be a function that displays all accounts in a file
It displays the last account twice, and if there is only one account, it displays it twice.
I thought it would be that I should use 'while' instead of 'for', but they are both similar in that they check first and then determine if to execute or not.

void Display(void)
{
FILE *fptr;
long i=0;

struct info rec={0,"","","",0,0};

newpage();//JUST TO CLEAR THE SCREEN (I used it in all other functions, no prob.)

if ((fptr=fopen("base.dat", "rb+"))== NULL)
{
printf("File could not be opened.");
}
else
{

for(; !feof(fptr) //go on until reaching feof
{
fread(&rec, sizeof(struct info), 1, fptr);

if (rec.account_no!=0)
{
i++;
printf("Your ID:%u\nYour Name:%s\nYour Date of Birth:%s\nYour Address:%s\nYour account number:%u\nYour Balance:%lf\n"
,rec.ID, rec.name, rec.DOB, rec.address, rec.account_no, rec.balance);
printf("\n");
}
}
if(i!=0)
printf("No accounts");
fclose(fptr);
}
endfunc();
}