Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    BaseFile::ReadBytes

    SDK Help
    0
    2
    229
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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 this

          
          
          
          
          char 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

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post