This program is ment to create a binary file holding integers 0 to 9. It includes two functions.
void build (FILE *fp);
void print (FILE *fp);
int main (void)
fp = fopen ("home/me/filename", "w+b");
void build (FILE *fp)
int i = 0;
while (i++ < 10)
fwrite (&i, sizeof (int), 1, fp);
void print (FILE *fp)
while (fread (&i, sizeof (int), 1, fp))
printf ("%d\n", i);
I can't see what is wrong with this code.
Any help appreciated.