WSPutUTF8Symbol (C Function)

int WSPutUTF8Symbol(WSLINK link,const unsigned char *s,int len)

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

Details

  • The symbol must be encoded in the UTF-8 character encoding form.
  • WSPutUTF8Symbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutUTF8Symbol() fails.
  • WSPutUTF8Symbol() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

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

void f(WSLINK lp)
{
    unsigned char symb[14];

    symb[0] = '$';
    symb[1] = 'H';
    symb[2] = 'o';
    symb[3] = 'm';
    symb[4] = 'e';
    symb[5] = 'D';
    symb[6] = 'i';
    symb[7] = 'r';
    symb[8] = 'e';
    symb[9] = 'c';
    symb[10] = 't';
    symb[11] = 'o';
    symb[12] = 'r';
    symb[13] = 'y';

    if(! WSPutUT8Symbol(lp, (const unsigned char *)symb, 14))
        { /* unable to put the symbol to lp */ }
}