I have a code but the problem is that it isn't putting the desired text to a text file. I have to have it in a function, can't have it in main. I do include stream, upstream, string, etc.
Why is it not adding the desired text to data.txt?Code:void gamesave(string gold, string health) { ofstream savefile ("data.txt", ios::out | ios::app | ios::binary); if (savefile.is_open()) { savefile << gold << "\n" << health << "\n"; } else { cout << RED << "Warning! Your file did not save" << endl; } }