This should make your life easier
I have got rid of all the usless stuff in the previous post to give you exactly want you you need to solve my problem.
Code:
#include <stdio.h>
struct rec
{
int the;
int x;
}r;
FILE *f;
int i,q;
int main()
{
r.x=0;
printf("how many");
scanf("%d", &i);
f=fopen("open_read","w");
if (!f)
return 1;
for (q=1;q<=i; q++)
{
r.the=q;
r.x++;
fwrite(&r,sizeof(struct rec),1,f);
}
fclose(f);
return 0;
}
I have added r.x to count the number of entries but into the file if you could read the last entry of r.x it would have the number of entries so then you would be able to make a loop like "for(q=1; q<=r.x; q++)" then read all then entrys. Thats how I would do it but i don't know how to read the last r.x.
If you would do it diffrently please do but can someone make a program which would read all the entrys, please it would be a great help.
I hope this helped you all in understanding what I'm trying to achive.