Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    wchar_t on macos [SOLVED]

    SDK Help
    0
    4
    464
    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

      On 13/04/2017 at 06:19, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   18 
      Platform:   Windows  ;   Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Hi,

      I'm using the pugi lib for dealing with XML files. The file methods require file paths in a wchar_t* buffer. On Windows I simple convert the string to a UInt16 buffer using GetUcBlock. But on macos this doesn't work. As far as I know, wchar_t is 32 bit on macos.

      So is there anybody, who has already found a solution?

      Thank you.

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

        On 13/04/2017 at 10:12, xxxxxxxx wrote:

        I guess this conversation on stackoverflow could help you http://stackoverflow.com/questions/9697203/convert-wchar-t-to-utf-16-string
         and this link http://unicode.org/faq/utf_bom.html#utf16-3

        Can sound stupid but do you really need XML files? Cause json are really easy to implement https://github.com/open-source-parsers/jsoncpp and it can do quite same things.

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

          On 13/04/2017 at 12:45, xxxxxxxx wrote:

          thank you for replying.

          Yes I need XML files because I want to support files that are already available.

          And yes, I have already googled and found some info like your tips. But I don't need to convert to UTF-16. I need to convert from 16 Bit strings to 32 bit strings.

          I solved the problem now by inserting this dowdy piece of code. The advantage is, that it certainly also works in Windows (although it's useless) so I can use the same code on both platforms.

            
          UInt16 filename[512];   
          fn.GetString().GetUcBlockNull(filename, 511);   
          wchar_t file[512];   
          Int32 i;   
          for (i = 0; i<512; i++)   
              file[i] = filename[i];     // expand to 32 bit chars on macos   
          pugi::xml_parse_result result = xmldoc.load_file(file);   
          

          Btw: pugi is a really nice XML parser and exporter.

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

            On 18/04/2017 at 08:58, xxxxxxxx wrote:

            Hi Klaus, thanks for writing us.

            With reference to your first post, I wonder if you were referring to a different Cinema release rather than R18 since the methods you were referring and using have been removed since R17. From R17.032 similar functionalities are brought by String::GetUtf16() and String::GetUtf32().

            Best, Riccardo

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