WSGetUCS2Symbol (C Function)

int WSGetUCS2Symbol(WSLINK link,const unsigned short **s,int *len)

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

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

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

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

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

    /* ... */

    WSReleaseUCS2Symbol(lp, symbol, len);
}