I'm developing a mod for Quake2. When the level is changed, some stats are cleared and some are written to save game file.
My mod has a level system that affects the power of weapons, etc things.
But, then i encountered a problem. I want to save my character data to a file and then read it to restore the values on level change.
A Friend of mine said that i should use fwrite for writing the data.
fwrite (&ent->client->pers.lvl, sizeof(int), 1, fp);
fwrite(&ent->client->pers.exp, sizeof(int), 1, fp);
fwrite(&ent->client->pers.money, sizeof(int), 1, fp);
But i dont have any idea how the read the data..I know the place where to read the data though.. So I'm requesting help on reading binary data.
(Also i dont know if i did something wrong in fwrite so someone can say a word or two about them for me)
Any help is welcome :)