MLPutUCS2String (C Function)

MLPutUCS2String has been replaced by WSPutUCS2String.

int MLPutUCS2String(MLINK link,const unsigned short *s,int n)

puts a string of n 16-bit UCS-2 characters to the MathLink 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.
  • MLPutUCS2String() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutUCS2String() fails.
  • MLPutUCS2String() is declared in the MathLink header file mathlink.h.

Examples

Basic Examples  (1)

#include "mathlink.h"

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

void f(MLINK 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(! MLPutUCS2String(lp, (const unsigned short *)str, 11))
        { /* unable to put the string to lp */ }
}