Thread: Write and use data stored in data files...

  1. #1
    Registered User alex6852's Avatar
    Join Date
    Sep 2001

    Lightbulb Write and use data stored in data files...

    Hi there. I guess you are familiar with old game called DOOM. If you are, you must know that all game data (models, levels, sounds etc.) situated in file called doom.wxd (takes 5-7 Mb). Well it just an example - now almoust all games have few data files like this. So let's jump to the question: "How can you write all that different kinds of data to a binary file and retrive it from there ?". Any help will be very userful. ThanX
    C++ rulez!!!

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    FILE* fp = fopen(thefile,"rb+");

    fread(yourdata,numberofitemstoread,sizeofeachitem, fp);
    //do whatever

    fwrite(yourdata,numberofitemstowrite,sizeofeachite m,fp);
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    In C you can only use file pointers. In C++ you can use file pointers or streams to manipulate files.

Popular pages Recent additions subscribe to a feed