I have
int main()
{
for(;;)
{
Database database;
in.read((char*)&database, 10*sizeof(database));
in.close();
if (database.MAIN.created == true) {
out.open("database.txt", ios::app);
out.write((char*)&database, 10 * sizeof(database)); out.close();
//maipulation.......}
else(){database.create_main()}
}
}
class Database
{
public:
Database();
void create_main();
Main MAIN;
std::vector<secondmain> second_main;
std::vector<thirdmain> third_main;
std::vector<clas> obj;
}
When I run the program it only saves the MAIN part even if I am creating vectors of the object in the same instance of the program. I can view those vectors and edit them but when I restart the program only the main object exists and the program crashes when it gets to a line where it has to deal with the other objects. Could it be because the vectors are not being saved properly?