#include <stdio.h>
struct rectangle
{
int x, y;
};
int main(int argc, char **argv)
{
FILE *f;
struct rectangle rec;
f = fopen("d:\\data.bin", "wb");
if (!f)
{
printf("Unable to open d:\\data.bin");
return 1;
}
for (int i = 1; i <= 10; i++)
{
rec.x = i * 2;
rec.y = i;
fwrite(&rec, sizeof(struct rectangle), 1, f);
}
fclose(f);
return(0);
}
/*
run:
*/