Skip navigation
Currently Being Moderated

How do I work around PIGetStr placing an invalid character in character buffer?

Sep 6, 2013 1:19 PM

In an Export plug-in, I need to read in the destination file path from scripting parameters.  Often, the character at exportPath[0] is junk and not an actual part of the path (hence the check).  Recently, this junk has actually been alphanumeric characters.  I can write a more accurate platform-dependent workaround, but would prefer an actual solution.  As a note, this happens whenever I use PIGetStr, not just in the case of reading filepaths.


Is there a standard way to handle this behavior?




case keyFilePath:


                    Str255 exportPath;

                    PIGetStr(token, &exportPath);

                    byte offset = 0;


                                   offset = 1;

                    strcpy_s((char*)gDestination, 256 - offset, (char*)exportPath + offset);

                    DescParams->playInfo = 0; //Don't pop dialog.




Result in exportPath:  Ec:\temp\assets\textures\brick_stacked_tile_01_SpecColor_gradients.dd s


Expected:  c:\temp\assets\textures\

  • Currently Being Moderated
    Sep 6, 2013 2:07 PM   in reply to drelidan

    From PITypes.h:

    typedef unsigned char Str255[256];  /*  first byte length of string. The string is zero terminated. */


    It's pure legacy - this is how strings in ol' good Pascal used to be organized

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points