Write and use data stored in data files...

This is a discussion on Write and use data stored in data files... within the C++ Programming forums, part of the General Programming Boards category; Hi there. I guess you are familiar with old game called DOOM. If you are, you must know that all ...

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

    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
    Posts
    2,267
    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
    Unregistered
    Guest
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21