Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Saving info to file

Author
Message
JIMAC
8
Years of Service
User Offline
Joined: 25th Nov 2011
Location: Scotland
Posted: 30th Jun 2012 19:01
I have almost finished a game project i am working on and have hit a wall, in my game you play through until completion upon which i want to ask for the players name and record this and the amount of deaths occurred during their game, i need the program to check the number of deaths and only overwrite the file if the deaths are lower and in both cases display the best score and by which player. I have made many attempts at this so far and keep getting an over run issue, if any one out there could supply me with this working code i would be eternally grateful, i really want to release this game to the public. the game code is pretty big so putting it on here would give you a headache however if you think you could get this working i would provide a link to download it, thanks for reading this is my first game and any help on this subject would help any future developments i pursue.

[URL=http://s1158.photobucket.com/albums/p620/jimac1888/?action=view¤t=level4.jpg][/URL]
Mr Bigglesworth
11
Years of Service
User Offline
Joined: 4th Mar 2008
Location:
Posted: 30th Jun 2012 20:02 Edited at: 30th Jun 2012 20:05
If you use std::fstream, you would open the file, check if the deaths are lower, and write to the file. So...



So now you can create a file "scores.txt" and put one 0 in it to make sure the first player will be recorded. (Or you could modify the code to do that )
JIMAC
8
Years of Service
User Offline
Joined: 25th Nov 2011
Location: Scotland
Posted: 30th Jun 2012 20:50
Thanks for taking the time to reply, and straight away you have gave me a fresh way of trying it, i seem to have bottle necked in my atemps so far this might be the nudge in the right direction i needed.

[URL=http://s1158.photobucket.com/albums/p620/jimac1888/?action=view¤t=level4.jpg][/URL]

Login to post a reply

Server time is: 2020-02-20 07:22:00
Your offset time is: 2020-02-20 07:22:00