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 arrays?

    Scheduled Pinned Locked Moved SDK Help
    3 Posts 0 Posters 212 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 19/06/2007 at 18:05, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   R8.2-R10 
      Platform:   Windows  ; Mac  ;  Mac OSX  ; 
      Language(s) :     C++  ;

      ---------
      Maybe it's me, but my plugin is crashing whenever I try to use an array of strings:

      String* strings;
      strings = bNew String[count];

      *strings = String("xxx");
      ++strings;

      This seems to cause grief. I've double checked the code and it seems on the up-and-up as far as cheching and setting. Is it possibly a problem of initialization of the strings in the array?

      This is only a temporary array storing names before tag assignments are made using them. Any alternatives ideas if this doesn't pan out?

      Thanks!

      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 20/06/2007 at 08:25, xxxxxxxx wrote:

        you are defining an array, but the contents of it are undefined. try this.

        String* strings[count];
        for(int x=0; x<count; x++)

        = new String("xxx");

        String *stringRef = strings[0];
        ++ stringRef;

        remember to free the strings after.

        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 20/06/2007 at 08:43, xxxxxxxx wrote:

          Actually I think that the problem has been found. I remembered to free the strings - but too early, forgetting that the individual group references were into that array.

          Was trying to use a single array to cover all of the instances in the group tree and handling that got sticky. Instead, the code now does a prepass to count the number of strings needed for each group and allocates individual arrays per group. Each group frees its String array after processing. It now works as expected. 🙂

          Thanks!

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