Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > MathLink C Language Functions >
MathLink C Function

MLGetUnicodeString()

int MLGetUnicodeString(MLINK link, unsigned short **s, long *n)
gets a character string from the MathLink connection specified by link, storing the string in s as a sequence of 16-bit Unicode characters.
  • MLGetUnicodeString() allocates memory for the character string. You must call MLDisownUnicodeString() to disown this memory. If MLGetUnicodeString() fails and the function's return value indicates and error, do not call MLDisownUnicodeString() on the contents of s.
  • MLGetUnicodeString() returns immutable data.
  • MLGetUnicodeString() stores all characters directly in 16-bit UCS-2 form.
  • ASCII characters are stored with a null high-order byte.
  • MLGetUnicodeString() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetUnicodeString() fails.
#include "mathlink.h"

/* read a UCS-2 encoded string from a link */

void f(MLINK lp)
{
    const unsigned short *string;
    long length;

    if(! MLGetUnicodeString(lp, &string, &length))
        {
            /* unable to read the UCS-2 string */
            return;
        }

    /* ... */

    MLDisownUnicodeString(lp, string, length);
}
© 2013 Wolfram Research, Inc. Japanese
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team