I've recently been experimenting with reading and loading binary files. I've written simple tile loading/saving functions which, to my complete and utter amazement, don't work.
The functions are as follows:
void LoadTiles(){ ifstream File("Data/Maps/map.bin", ios::in | ios::binary); File.read ((char*)&Tiles, sizeof (TileSystem)); File.close();}void SaveTiles(){ ofstream File("Data/Maps/map.bin", ios::out | ios::binary); File.write ((char*)&Tiles, sizeof (TileSystem)); File.close();}
TileSystem is a class btw. and Tiles is a TileSystem.
Saving results in a 1kb file which may or may not contain my class. Loading *seems* to work but then, apparently, a call to "Tiles.size()" gives me an access violation error.
Gee, programming sure is full of bumpy bumps...
What am I doing wrong?
Thanks in advance :)