Best way to save and restore config files

Swift Games Accounts
  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
  • ► You must register to download attachments!
Apr 3, 2013
I'm trying to create a configuration file (mine in this case is simply config.txt) that can be saved based on your menu selections and when you relaunch the hack you can click Load config.txt.

//THIS IS C++, std::boolalpha is to have the bools print as true instead of 1, if I remove std::boolalpha then save>load>save then the text file will print garbage numbers like 204 for bools
	void LoadConfig()
		ifstream in("config.txt");
		in >>std::boolalpha>> espactive  >> bunnyactive >> espspecial>>  esphumans>>  espinfected>>  espsnapline >> espmehealth>>  esp3D >> esphealth >> espzomhealth>>  aimbotactive >> aimbothumans>>  aimbotspecial>>  aimbotsmooth >> aimbotbounce >> fovdist>>aimbotkey>>triggerkey>>aimFOV>>aimsens;
	void SaveConfig()
		ofstream out("config.txt");
		out <<std::boolalpha<< espactive  << bunnyactive << espspecial<<  esphumans<<  espinfected<<  espsnapline << espmehealth<<  esp3D << esphealth << espzomhealth<<  aimbotactive << aimbothumans<<  aimbotspecial<<  aimbotsmooth << aimbotbounce << fovdist<<aimbotkey<<triggerkey<<aimFOV<<aimsens;
everything is booleans until it gets to aimbotkey, triggerkey,aimFOV, aimsens
aimbotkey,triggerkey are integers
aimfov,aimsens are float values.

When I save configuration this is what I usually get saved into my .txt document

aimbotkey = 1
triggerkey = 2
aimfov = 10 //uses slider bar
aimsens = 1.25 //uses slider bar

Loading the config.txt will set everything back the way it way until after aimbotkey, I think I'm reading the values incorrectly(fstream is new to me) because I'm not sure if using my technique as above is only reading one character or not because my float values can be from 1 char to 4 chars.

It's not loading as soon as I get to the numbers in the config.txt

Here's what it will look like, I'll save the hack, then click load afterwards before anything else and you can see the keybindings change which is incorrect

Thanks so much for reading.

if there is a better way to do this that you guys can help me with that would be appreciated as well.


Respected Hacker
Legacy Donator
Dank Tier VIP
Oct 14, 2012
Yeah maybe just save like "01 00 01 00 01 01 00 01 01" then load the file while every byte there stand for on or off (you might have done it like that but it's too much text to read and I'm too lazy for that)


Kim Kong Trasher
Legacy Donator
Dank Tier VIP
Jul 19, 2012
Mankei Iland
Use .ini or .xml, .. eg. WriteProfileString/ReadProfileString or some simple xml parser. I got my menu separated into tabs, each tab will be a app name in ini and each menu element is a key. I iterate over all the menu items and based on type format the value accordingly.
Jul 7, 2014
Just make the format be separated by a new line '\n'. Simplest way there is. Read in a line, that's the first option's value. read in the second line, that's the second option's value, etc. Super simple. And depending on the line you could parse it differnetly - boolean, or integer.