MLPutUTF32String (C 函数)

MLPutUTF32String 已经被 WSPutUTF32String 所取代.

int MLPutUTF32String(MLINK link,const unsigned int *s,int len)

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

更多信息

  • MLPutUTF32String() 在错误事件中返回0,如果函数成功则返回非零值.
  • 如果 MLPutUTF32String() 失败,则使用 MLError() 检索错误代码.
  • MLPutUTF32String() 在 MathLink 标头文件 mathlink.h 中被声明.

范例

基本范例  (1)

#include "mathlink.h"

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

void f(MLINK 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(! MLPutFunction(lp, "EvaluatePacket", 1))
        { /* unable to put the function to lp */ }

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

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

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

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