dockthepod
Member
I'm having a hard time writing to the SD. It creates the file, but it's empty. I gather that I need to sync the SD card somehow, but I haven't been able to figure out how. My code works fine in windows.
I'm having a hard time writing to the SD. It creates the file, but it's empty. I gather that I need to sync the SD card somehow, but I haven't been able to figure out how. My code works fine in windows.
ifstream hiscore(FILENAME);
if(hiscore.is_open())
{
hiscore >> topScore;
hiscore.close();
}
if( theWorld.GetScore() > topScore )
{
topScore = theWorld.GetScore();
ofstream oscore;
oscore.open(FILENAME, ios::trunc);
if(!oscore)
exit(0);
else
{
oscore << topScore;
oscore.close();
sync();
}
}
So I think my program is just fine. I think it's my SD that's messed up. Someone else tried my game and the saving was working just fine.
I think that maybe gmenu2x messed things up, or at least was affected by the same problem. When I create links in there it, it ends up writing out 0 byte files, just like my app is. When I try to delete these from windows, the files are locked and I can't delete them. This all happened before I added saving to my app and after I installed gmenu2x. Maybe it's just a coincidence, but a format is in order I believe.