WSPutUTF16Symbol (C Function)

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

puts a symbol whose name is given by UTF-16 encoded string s with length len to the WSTP connection specified by link.


  • The symbol must be encoded in the UTF-16 character encoding form.
  • The symbol s must start with a byte order mark.
  • The length of the symbol len must include the byte order mark.
  • WSPutUTF16Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutUTF16Symbol() fails.
  • WSPutUTF16Symbol() is declared in the WSTP header file wstp.h.


Basic Examples  (1)

#include "wstp.h"

/* send the symbol $InstallationDirectory to a link */

void f(WSLINK lp)
    unsigned short symb[23];

    symb[0] = 0xFEFF;
    symb[1] = '$';
    symb[2] = 'I';
    symb[3] = 'n';
    symb[4] = 's';
    symb[5] = 't';
    symb[6] = 'a';
    symb[7] = 'l';
    symb[8] = 'l';
    symb[9] = 'a';
    symb[10] = 't';
    symb[11] = 'i';
    symb[12] = 'o';
    symb[13] = 'n';
    symb[14] = 'D';
    symb[15] = 'i';
    symb[16] = 'r';
    symb[17] = 'e';
    symb[18] = 'c';
    symb[19] = 't';
    symb[20] = 'o';
    symb[21] = 'r';
    symb[22] = 'y';

    if(! WSPutUTF16Symbol(lp, (const unsigned short *)symb, 23))
        { /* unable to put the symbol to lp */ }