Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<istream>
- #include<ostream>
- #include<fstream>
- using namespace std;
- struct s_pData
- {
- int currentL;
- };
- s_pData pData;
- void loadSettings()
- {
- // -- First from file -- //
- ifstream file("game.dat", ios::binary);
- if (file.good())
- {
- // -- Language -- //
- file.read((char*)&pData, sizeof(pData));
- file.close();
- }
- }
- void saveSettings()
- {
- ofstream file("game.dat", ios::binary);
- if (file.good())
- {
- // -- Language -- //
- file.write((char*)&pData, sizeof(pData));
- file.close();
- }
- }
- int main()
- {
- loadSettings();
- cout << pData.currentL << endl;
- pData.currentL = 88;
- saveSettings();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement