#include <stdio.h>
struct rectangle
{
int x, y;
};
int main(int argc, char **argv)
{
FILE *f;
struct rectangle rec;
f = fopen("d:\\data.bin", "rb");
if (!f)
{
printf("Unable to open d:\\data.bin");
return 1;
}
for (int i = 1; i <= 10; i++)
{
fread(&rec, sizeof(struct rectangle), 1, f);
printf("%d %d\n", rec.x, rec.y);
}
fclose(f);
return(0);
}
/*
run:
2 1
4 2
6 3
8 4
10 5
12 6
14 7
16 8
18 9
20 10
*/