try this:
Code:
#include <iostream>
#include <fstream>
using namespace std;
struct test
{
public:
test(int X, int Y) { x = X; y = Y; }
int GetX() { return x; }
int GetY() { return y; }
void SetX(int num) { x = num; }
void SetY(int num) { y = num; }
private:
int x;
int y;
};
int main()
{
test bla(5, 10);
ofstream fout("save.txt", ios::binary);
fout.write((char*)&bla, sizeof(bla)); // Saving
fout.close();
test bu(1, 1); // Where we want to load the saved structure
ifstream fin("save.txt", ios::binary);
fin.read((char*)&bu, sizeof(bu)); // Loading
fin.close();
}