View Full Version : binary stream locale and encoding

05 May 2009, 01:43 PM
I don’t see any information on the locale and encoding of strings, integral types, or floats for the binary stream operations in the documentation.

“as string”
“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.

code like:

D3DXCOLOR ambientColor<char *>(&ambientColor.r), 4);<char *>(&ambientColor.g), 4);<char *>(&ambientColor.b, 4);<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.

CGTalk Moderation
05 May 2009, 01:43 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.