C: Reading strings from binary file

First of all I guess you need to change the “if” line at the end to:

 if((fwrite(&apartments, sizeof(apartments), 1, fp))!=1)

You forgot to put &..

second… if you want to
read from the file you do the same thing with fread function

 fread(&apartments, sizeof(apartments), 1, fp);

and the you can print it so you can see the data..




Browse More Popular Posts

Leave a Comment