WSGetUTF32String (C Function)

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

gets a character string from the WSTP connection specified by link, storing the string in s as a sequence of UTF-32 characters and the length of the string in len.


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


Basic Examples  (1)

#include "wstp.h"

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

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

    if(! WSGetUTF32String(lp, &string, &len))
            /* unable to read the UTF-32 string from lp */

    /* ... */

    WSReleaseUTF32String(lp, string, len);