MLGetIntegerList (C 関数)
MLGetIntegerListはWSGetIntegerListに置き換えられた.
int MLGetIntegerList(MLINK link,int **a,long *n)
link で指定されたMathLink接続から整数のリストを得て,その整数を配列 a に,そしてリストの長さを n に保持しておく.
詳細

- MLGetIntegerList()は整数の配列にメモリを割り当てる.このメモリを開放するためにはMLDisownIntegerList()を呼び出さなくてはならない.MLGetIntegerList()が不成功で関数の返す値がエラーを示す場合には,a のコンテンツについてMLDisownIntegerList()を呼び出してはならない.
- MLGetIntegerList()は不変のデータを返す.
- MLGetIntegerList()はエラーがあると0を返し,関数が成功すると0以外の値を返す.
- MLError()を使うと,MLGetIntegerList()が不成功の場合にエラーコードを引き出すことができる.
- MLGetIntegerList()は,MathLinkヘッダファイルmathlink.hの中で宣言される.
- MLGetIntegerList()は,MLGetInteger32List()と等価である.
例題
例 (1)
#include "mathlink.h"
/* read a list of integers from a link */
void f(MLINK lp)
{
int *data;
long length;
if(! MLGetIntegerList(lp, &data, &length))
{
/* unable to read the integer list from lp */
return;
}
/* ... */
MLDisownIntegerList(lp, data, length);
}