WSGetUTF32Symbol (C Function)

int WSGetUTF32Symbol(WSLINK link,const unsigned int **s,int *len)

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

Details

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

Examples

Basic Examples  (1)

#include "wstp.h"

/* read a UTF-32 encoded symbol from a link */

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

    if(! WSGetUTF32Symbol(lp, &symbol, &len))
        {
            /* unable to read the UTF-32 symbol from lp */
            return;
        }

    /* ... */

    WSReleaseUTF32Symbol(lp, symbol, len);
}