It's saving to the .txt file, but not loading anything.
Code:void SaveGame (void) { ofstream fout; fout.open("XFstats.txt"); fout << "Do not change or edit the contents of this file. "<<endl<<endl<<endl; fout << kills; fout << "Health: "<< yourhealth; fout << "Weapons: " << crossbow << axe << bronzesword << silversword << goldsword << platinumsword << flamethrower << rocketlauncher << endl; fout << "Money: " << money << endl; fout << "Difficulty: " << easy << hard << endl; fout.close(); cout<<endl<<"Game saved successfully!"<<endl; getch(); repeat(); } void LoadGame (void) { ifstream fin; char szWord[] = ""; fin.open("XFstats.txt"); if(fin.fail()) { cout << "ERROR: Could not find XFstats.txt!\n"; } fin.seekg(NULL, ios::beg); fin.clear(); fin >> szWord >> kills; fin >> szWord >> yourhealth; fin >> szWord >> crossbow >> axe >> bronzesword >> silversword >> goldsword >> platinumsword >> flamethrower >> rocketlauncher; fin >> szWord >> money; fin >> szWord >> easy >> hard; fin.close(); cout<<endl<<"Game loaded successfully!"<<endl; getch(); repeat(); }



LinkBack URL
About LinkBacks



since you cant save/load a pointer i had to convert them into integers and convert them back on loading....