I'm trying to store a class in a file but I dont know exactly how to do that.
This is how far I've come:
Of corse it doesnt work but I cant figure out what to do now...Code:
void saveD(Data& savedD)
{
ofstream save("Data.dat",ios::trunc,filebuf::binary);
save<<savedD;
if(!save.bad())
{
cout<<"Error saving data";
save.close();
exit(0);
}
save.close();
}
Oh and some code to load the data from the file would be handy too :D