“4 byte integer”
“4 byte float”
None of these tell very much about how to read the binary back again.
All characters are ASCII?
Byte size is 8?
Bit order is little indian?
My biggest problem is signed numbers - Two-complement, One-complement, sign+magnitude, BCD, etc?
How are we storing floats?
What is used?
I’ve got to write a corresponding C++ parser for the data written out by maxscript.
file.read(reinterpret_cast<char *>(&ambientColor.r), 4);
file.read(reinterpret_cast<char *>(&ambientColor.g), 4);
file.read(reinterpret_cast<char *>(&ambientColor.b, 4);
file.read(reinterpret_cast<char *>(&ambientColor.a), 4);
Is not satisfactory, as a user may change encoding and locale of client programs that use my library and break the parser. I need to explicitly handle the encoding of each type, reading byte by byte, assembling strings, integers, and floats from the data, then transforming to the local encoding.