C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 11th, 2003, 03:37 PM
arbitus arbitus is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: Oh, USA
Posts: 3 arbitus User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 12 sec
Reputation Power: 0
Send a message via AIM to arbitus Send a message via Yahoo to arbitus
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

Reply With Quote
  #2  
Old May 11th, 2003, 05:03 PM
bass20 bass20 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 16 bass20 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation 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

Reply With Quote
  #3  
Old May 20th, 2003, 04:50 PM
ComputerGuy356 ComputerGuy356 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 25 ComputerGuy356 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 51 m 4 sec
Reputation 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 04:45 PM.

Reply With Quote
  #4  
Old May 21st, 2003, 08:47 AM
Onslaught's Avatar
Onslaught Onslaught is offline
/(bb|[^b]{2})/
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Nov 2001
Location: Somewhere in the great unknown
Posts: 4,840 Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level)Onslaught User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 2 Days 36 m 16 sec
Reputation Power: 88
Send a message via ICQ to Onslaught
In the future please use a more appropriate subject title.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > save


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT