|
SOLUTIONS
|
MLPutString()
int MLPutString(MLINK link, const char*s)
ヌル終端のC言語の文字列をlink で指定されたMathLink 接続に置く.
詳細詳細
- 文字列中の原始文字バックスラッシュは,2文字,つまり「\\」として送信されなければならない.
- 特殊文字はMLGetString()が返す形式でのみ,送信可能である.
- 通常使用されるコード化形式はMLGetString()で使用されるものと同じである.
- MLPutString()はエラーがあると0を返し,関数が成功すると0以外の値を返す.
- MLError()を使うと,MLPutString()が不成功の場合にエラーコードを引き出すことができる.
- MLPutString()はMathLink ヘッダファイルmathlink.hの中で宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (1)
#include "mathlink.h"
/* send a string representing an expression to a Mathematica kernel
for evaluation */
void f(MLINK lp)
{
/* construct the packet to be sent to the kernel */
MLPutFunction(lp, "EvaluatePacket", 1);
MLPutFunction(lp, "ToExpression", 1);
MLPutString(lp, (const char *)"3+4/Sqrt[19.2]");
MLEndPacket(lp);
/* send the packet */
if(! MLFlush(lp))
{ /* unable to flush an outgoing data buffered in lp */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
