|
SOLUTIONS
|
MATHEMATICA MATHLINK C 関数
MLPutInteger16()
int MLPutInteger16(MLINK link, int i)
16ビットの整数i をlink で指定されたMathLink 接続に置く.
詳細詳細
- 引数i は通常外部プログラムではshort型と宣言されるが,C言語のプロトタイプがない場合にも作動するように,MLPutInteger16()内ではint型と宣言されなければならない.
- MLPutInteger16()はエラーがあると 0 を返し, 関数が成功すると0以外の値を返す.
- MLError()を使うと,MLPutInteger16()が不成功の場合にエラーコードを引き出すことができる.
- MLPutInteger16()はMathLink ヘッダファイルmathlink.hの中で宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (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 */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
