WSPutUCS2String (C Function)

int WSPutUCS2String(WSLINK link,const unsigned short *s,int n)

puts a string of n 16-bit UCS-2 characters to the WSTP connection specified by link.

Details

  • All characters are assumed to be 16-bit characters.
  • 8-bit characters can be sent by having the higher-order byte be null.
  • WSPutUCS2String() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutUCS2String() fails.
  • WSPutUCS2String() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* send the string "Hello World" to a link */

void f(WSLINK lp)
{
    unsigned short str[11];

    str[0] = 'H';
    str[1] = 'e';
    str[2] = 'l';
    str[3] = 'l';
    str[4] = 'o';
    str[5] = ' ';
    str[6] = 'W';
    str[7] = 'o';
    str[8] = 'r';
    str[9] = 'l';
    str[10] = 'd';

    if(! WSPutUCS2String(lp, (const unsigned short *)str, 11))
        { /* unable to put the string to lp */ }
}