WSPutUTF32String (C 函数)

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

把长度为 len 的 UTF-32 字符串 s 写入由 link 指定的 WSTP 连接.

更多信息

  • 若发生错误,则 WSPutUTF32String() 返回0;若函数成功,则返回非零值.
  • WSPutUTF32String() 失败,则使用 WSError() 检索错误代码.
  • WSTP 的标头文件 wstp.h 已对 WSPutUTF32String() 作出声明.

范例

基本范例  (1)

#include "wst.h"

/* send the expression N[10/Sin[2]] as a UTF-32 string to a link */

void f(WSLINK lp)
{
    unsigned int expr[13];

    expr[0] = 0xFEFF;
    expr[1] = 'N';
    expr[2] = '[';
    expr[3] = '1';
    expr[4] = '0';
    expr[5] = '/';
    expr[6] = 'S';
    expr[7] = 'i';
    expr[8] = 'n';
    expr[9] = '[';
    expr[10] = '2';
    expr[11] = ']';
    expr[12] = ']';

    if(! WSPutFunction(lp, "EvaluatePacket", 1))
        { /* unable to put the function to lp */ }

    if(! WSPutFunction(lp, "ToExpression", 1))
        { /* unable to put the function to lp */ }

    if(! WSPutUTF32String(lp, (const unsigned int *)expr, 13))
        { /* unable to put the expression string to lp */ }

    if(! WSEndPacket(lp))
        { /* unable to put the end-of-packet indicator to lp */ }

    if(! WSFlush(lp))
        { /* unable to flush any outgoing data buffered in lp */ }
}