MLPutUTF16String()

int MLPutUTF16String(MLINK link, const unsigned short *s, int len)
把长度为 len 的 UTF-16 字符串 s 写入由 link 指定的 MathLink 连接.

更多信息更多信息

  • MLPutUTF16String() 自动决定字符串 s 中的字符数.
  • MLPutUTF16String() 在错误事件中返回0,如果函数成功则返回非零值.
  • 如果 MLPutUTF16String() 失败,则使用 MLError() 检索错误代码.
  • MLPutUTF16String()MathLink 标头文件 mathlink.h 中被声明.

范例范例打开所有单元关闭所有单元

基本范例 (1)基本范例 (1)

#include "mathlink.h"

/* send the expression N[10/Sin[2]] to a link */

void f(MLINK lp)
{
    unsigned short expr[12];

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

    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(! MLPutUTF16String(lp, (const unsigned short *)expr, 12))
        { /* 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 */ }
}
New to Mathematica? Find your learning path »
Have a question? Ask support »