MLGetUCS2Symbol (C Function)

MLGetUCS2Symbol has been replaced by WSGetUCS2Symbol.

int MLGetUCS2Symbol(MLINK link,const unsigned short **s,int *len)

gets a UCS-2 character string corresponding to the name of a symbol from the MathLink connection specified by link, storing the resulting string in s and length in len.

Details

  • MLGetUCS2Symbol() allocates memory for the character string. You must call MLReleaseUCS2Symbol() to disown this memory. If MLGetUCS2Symbol() fails and the function's return value indicates an error, do not call MLReleaseUCS2Symbol() on the contents of s.
  • MLGetUCS2Symbol() returns immutable data.
  • MLGetUCS2Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLGetUCS2Symbol() fails.
  • MLGetUCS2Symbol() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

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

void f(MLINK lp)
{
    const unsigned short *symbol;
    int len;

    if(! MLGetUCS2Symbol(lp, &symbol, &len))
        {
            /* unable to retrieve the UCS-2 symbol */
            return;
        }

    /* ... */

    MLReleaseUCS2Symbol(lp, symbol, len);
}