When working with binary files, you also need to pay attention to endianness.
only if you change hardware
When working with binary files, you also need to pay attention to endianness.
only if you change hardware
Norm Barrows
Rockland Software Productions
"Building PC games since 1989"
PLAY CAVEMAN NOW!
http://rocklandsoftware.net/beta.php
Always, always, always start with a version number.
I cannot tell you how many times I have had a bug report saying "load game broken". When I look at it the tester has tried to load a saved game from an earlier version of the game, something is in the wrong place and everything goes bang.
Always, always, always start with a version number.
Version numbers for the file, version numbers for the structures, version numbers for everything.
In quite a few projects I've seen a whole bunch of load functions, much like a factory. First it loads the version number, then a switch statement full of functions named LoadV1(), LoadV2(), LoadV3(), LoadV4(), and so on. Also popular are a chain of functions ConvertV1toV2(), ConvertV2toV3(), ConvertV3toV4(), and so on.