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

    String to char

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 326 Views
    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 Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 29/04/2007 at 14:03, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:    
      Platform:      
      Language(s) :

      ---------
      i could use some help 🙂

      im using tinyXML wrapper to write data to an xml and i need to convert a string

      String tempString = filename.GetString();

      to char (not to be confused with CHAR).

      i have NO CLUE.

      thanks in advance!

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 29/04/2007 at 14:38, xxxxxxxx wrote:

        ahhh... nevermind

        🙂

        solution:

        char* ExportXML::StringToChar(String s)
        {
             LONG len = s.GetCStringLen(St8bit);
             char* c = bNew CHAR[len+1];
             s.GetCString(c, len+1, St8bit);
             return c;
        }

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 29/04/2007 at 17:45, xxxxxxxx wrote:

          Glad to see that you worked it out quickly! 🙂

          One suggestion, do this (which may prove slightly speedier if you are calling this StringToChar() often) :

          char* ExportXML::StringToChar(String s)  
          {  
               LONG len = s.GetCStringLen(St8bit)+1;  
               char* c = bNew CHAR[len];  
               s.GetCString(c, len, St8bit);  
               return c;  
          }
          

          Not much difference - but an addition here, multiplication there can have an impact in methods used very frequently. Must be from reading all of those darned 3D books where they ledger out the cost of every operation! 😉

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