MLPutInteger16 (C 函数)

MLPutInteger16 已经被 WSPutInteger16 所取代.

int MLPutInteger16(MLINK link,int i)

把16位整数 i 写入由 link 指定的 MathLink 连接.

更多信息

  • 自变量 x 在外部程序中一般被声明为 short,但是在 MLPutInteger16() 中必须声明为 int,以便于在没有 C 原型的情况下也可以用.
  • MLPutInteger16() 在错误事件中返回0,如果函数成功则返回非零值.
  • 如果 MLPutInteger16() 失败,则使用 MLError() 检索错误代码.
  • MLPutInteger16() 在 MathLink 标头文件 mathlink.h 中被声明.

范例

基本范例  (1)

#include "mathlink.h"

/* send the expression Times[10,30] to a link */

void f(MLINK lp)
{
    short a = 10;
    short b = 30;

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

    if(! MLPutInteger16(lp, a))
        { /* unable to put the integer to lp */ }

    if(! MLPutInteger16(lp, b))
        { /* unable to put the integer to lp */ }

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

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