|
SOLUTIONS
|
MATHEMATICA MATHLINK C 関数
MLTransferExpression()
詳細詳細
- dst とsrc とが異なっている必要はない.
- dst とsrc は,ループバックリンクでもよいし,普通のリンクでもよい.
- MLTransferExpression()はエラーがあると0を返し,関数が成功するとゼロ以外の値を返す.
- MLTransferExpression()はリンクからの式を読み取って,それをループバックリンクに保持するためによく使われる.
- MLTransferExpression()はMathLink ヘッダファイルmathlink.hで宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (1)
#include "mathlink.h"
/* transfer an expression to link 2 from loopback link 1 */
void f(MLINK lp2, MLINK lp1)
{
/* send EvaluatePacket[ToExpression[str]] to lp1 */
if(! MLPutFunction(lp1, "EvaluatePacket", 1))
{ /* unable to put function to lp1 */ }
if(! MLPutFunction(lp1, "ToExpression", 1))
{ /* unable to put function to lp1 */ }
if(! MLPutString(lp1, "a = Table[RandomInteger[2,12]];"))
{ /* unable to put the string to lp1 */ }
if(! MLEndPacket(lp1))
{ /* unable to put the end-of-packet indicator to lp1 */ }
if(! MLFlush(lp1))
{ /* unable to put flush any outgoing data buffered in lp1 */ }
/* now transfer to lp2 from lp1 */
if(! MLTransferExpression(lp2, lp1))
{ /* unable to transfer an expression from lp1 to lp2 */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
