MLGetUTF16String has been replaced by WSGetUTF16String.

int MLGetUTF16String(MLINK link,const unsigned short **s,int *n,int *c)

gets a UTF-16 character string from the MathLink connection specified by link, storing the string in s, the length of the string in n, and the number of characters in c.


  • MLGetUTF16String() allocates memory for the character string. You must call MLReleaseUTF16String() to disown this memory. If MLGetUTF16String() fails and the function's return value indicates an error, do not call MLReleaseUTF16String() on the contents of s.
  • MLGetUTF16String() returns immutable data.
  • MLGetUTF16String() stores all characters directly in the UTF-16 Unicode encoding form.
  • The string s returned by MLGetUTF16String() begins with a byte order mark.
  • The length of the string n includes the byte order mark.
  • MLGetUTF16String() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetUTF16String() fails.
  • MLGetUTF16String() is declared in the MathLink header file mathlink.h.


Basic Examples  (1)

#include "mathlink.h"

/* read a UTF-16 encoded string from a link */

void f(MLINK lp)
    const unsigned short *string;
    int length;
    int characters;

    if(! MLGetUTF16String(lp, &string, &length, &characters))
            /* unable to read the UTF-16 string from lp */

    /* ... */

    MLReleaseUTF16String(lp, string, length);

See Also

MLGetString()  MLGetByteString()  MLGetUCS2String()  MLGetUTF8String()  MLGetUTF32String()