MLPutInteger16 (C 関数)

MLPutInteger16WSPutInteger16に置き換えられた.

int MLPutInteger16(MLINK link,int i)

16ビットの整数ilink で指定されたMathLink接続に置く.

詳細

  • 引数i は通常外部プログラムではshort型と宣言されるが,C言語のプロトタイプがない場合にも作動するように,MLPutInteger16()内ではint型と宣言されなければならない.
  • MLPutInteger16()はエラーがあると 0 を返し, 関数が成功すると0以外の値を返す.
  • MLError()を使うと,MLPutInteger16()が不成功の場合にエラーコードを引き出すことができる.
  • 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 */ }
}