Thread: save

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Location
    Oh, USA
    Posts
    3
    Rep Power
    0

    save


    Well yesterday I started programming a game (with dos as the exicuter) and I realized. this is gonna be a big game. How do poeple save!? So I am here to ask if there is any way to save a game or make a file of where the game is with dos as the program runner. thnx
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    16
    Rep Power
    0
    You can save your program's info into a file for later access:

    http://www.ee.surrey.ac.uk/Personal/...C/fileops.html
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    25
    Rep Power
    0
    This is an example of code that writes a file:


    fstream File;
    File.open ("save.dat", ios::out | ios::binary);
    if (File.is_open ())
    { File.write ((char *) &tempcards, sizeof (char) * 42 );
    File.write ((char *) &bid, sizeof (char) * 3);
    File.write ((char *) &version, sizeof (int) );
    File.write ((char *) &GameRunningStat, sizeof (int) );
    File.write ((char *) &bidturn, sizeof (int) );
    File.write ((char *) &player1bid, sizeof (int) );
    File.write ((char *) &player2bid, sizeof (int) );
    File.write ((char *) &player3bid, sizeof (int) );
    File.write ((char *) &player4bid, sizeof (int) );
    File.write ((char *) &player1ask, sizeof (int) );
    File.write ((char *) &player2ask, sizeof (int) );
    File.write ((char *) &player4ask, sizeof (int) );
    File.write ((char *) &enter, sizeof (int) );
    File.write ((char *) &highbid, sizeof (int) );
    File.write ((char *) &yourscore, sizeof (int) );
    File.write ((char *) &theirscore, sizeof (int) );
    }
    File.close ();
    Last edited by ComputerGuy356; May 21st, 2003 at 05:45 PM.
  6. #4
  7. /(bb|[^b]{2})/

    Join Date
    Nov 2001
    Location
    Somewhere in the great unknown
    Posts
    5,163
    Rep Power
    793
    In the future please use a more appropriate subject title.

IMN logo majestic logo threadwatch logo seochat tools logo