BaseFile::ReadBytes
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 25/01/2004 at 15:41, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.206
Platform:
Language(s) : C++ ;---------
Hi, im quite new to file io with c++ sdk
The SDK states that BaseFile::ReadBytes will not be platform independant.
To make sure platform idependancy, what would be the best method to read a 64 byte string from a file?
current im using thischar info[64]; file->ReadBytes(&info, sizeof(info));
this works fine, but would it be wise to use the BaseFile::ReadChar() 64 times instead?
and while im here, how can I convert a char[] array into a String, so I can use the GePrint method.
Thanks -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/01/2004 at 01:53, xxxxxxxx wrote:
The comment in the docs refers to that ReadBytes() only reads raw bytes, while most of the other functions handles the byte order automatically. So if you use Read/WriteBytes() to directly load/save a structure that contains integers or floats, then it won't be platform independent.
If you're reading a format that you haven't written yourself, and want to use ReadBytes(), then you should look up the byte order that the format uses and then use GeGetByteOrder() to see if you need to swap the bytes for the current platform.
For a string byte order will of course only matter if it uses more than one byte per character.