|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|||
|
|||
|
You can save your program's info into a file for later access:
http://www.ee.surrey.ac.uk/Personal.../C/fileops.html |
|
#3
|
|||
|
|||
|
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 04:45 PM. |
|
#4
|
||||
|
||||
|
In the future please use a more appropriate subject title.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > save |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|