好吧,我有一个对象:
LivingObject* myPlayer=new LivingObject(...);
我想在退出时将其写入文件。这是我到目前为止所拥有的:
std::fstream myWrite;
myWrite.open("Character.dat",std::ios::binary|std::ios::app);
myWrite.write((char*)myPlayer,sizeof(myPlayer));
myWrite.close();
退出时我查看了文件并且大小根本没有增加(我假设它没有写入)。我做错了什么?