Page 1 of 1

Input/Output of Structure Binaries?

PostPosted: Thu Sep 07, 2006 7:09 am
by Cleve_Blakemore
1. Does the C-Script library support "sizeof" for structures, to determine their length in bytes?

2. Can we output a structure to disk as a binary using the file commands, input it later in the same way and expect it will be byte-aligned and consistent on all export platforms?

3. Can we then import structures from byte-aligned editors using our structure format, also as an entire binary chunk?

I know I can find out all this myself by building tests, Makslane, but I guess I am being lazy and hoping you can answer all these questions for me in one go.

I can throw together editors of all sorts very quickly with binary outputs of structures as big arrays. This would help speed up item and creature editing for my Game Editor isometric game a lot. I can do it as INI style files as well, but this will entail building a little INI parser for Game Editor. It saves a lot of time if I can have a couple of binary files travel with the executable on all platforms and expect the byte aligned structs to import at the same length on all of them. I know the "&" address pointer is supported in Game Editor C-Script.

Thanks for your help in advance.

PostPosted: Thu Sep 07, 2006 12:36 pm
by makslane
It's a good question. I had serious trouble with struct alignment in the GP2X platform. So, I think save structs will works in all platforms, but not in the GP2X without engine modifications.

Can you make a little test with an struct that contains double, int, char and some array? :wink: