Ok I've tried doing the object serialization, but it doesn't quite work. Here's what I have:
It compiles fine, and it writes ok to the .ros file. However, when I read this file into my_class2, it doesn't set the variables of my_class2 to be equal to those of my_class1, like I want it to. It doesn't set my_class2.x and my_class2.y to anything - they are left at -85983560 or something...
using namespace std;
My_Class(int a, int b)
x = a;
y = b;
My_Class my_class1(2, 5);
ofstream ofs("D:\\my_class.ros", ios::binary);
ofs.write((char *)&my_class1, sizeof(my_class1));
ifstream ifs("D:\\my_class.ros", ios::binary);
ifs.read((char *)&my_class2, sizeof(my_class2));
Any ideas on what I am doing wrong? I followed this example from a tutorial and I can't see any differences between my code and theirs...