|
SOLUTIONS
|
MLPutUTF16String()
int MLPutUTF16String(MLINK link, const unsigned short *s, int len)
長さlen のUTF-16文字列s を,link で指定されたMathLink 接続に置く.
詳細詳細
- MLPutUTF16String()は文字列s の文字数を自動的に測定する.
- MLPutUTF16String()はエラーがあると0を返し,関数が成功すると0以外の値を返す.
- MLError()を使うと,MLPutUTF16String()が不成功の場合にエラーコードを引き出すことができる.
- MLPutUTF16String()はMathLink ヘッダファイルmathlink.hの中で宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (1)
#include "mathlink.h"
/* send the expression N[10/Sin[2]] to a link */
void f(MLINK lp)
{
unsigned short expr[12];
expr[0] = 'N';
expr[1] = '[';
expr[2] = '1';
expr[3] = '0';
expr[4] = '/';
expr[5] = 'S';
expr[6] = 'i';
expr[7] = 'n';
expr[8] = '[';
expr[9] = '2';
expr[10] = ']';
expr[11] = ']';
if(! MLPutFunction(lp, "EvaluatePacket", 1))
{ /* unable to put the function to lp */ }
if(! MLPutFunction(lp, "ToExpression", 1))
{ /* unable to put the function to lp */ }
if(! MLPutUTF16String(lp, (const unsigned short *)expr, 12))
{ /* unable to put the expression string to lp */ }
if(! MLEndPacket(lp))
{ /* unable to put the end-of-packet indicator to lp */ }
if(! MLFlush(lp))
{ /* unable to flush any outgoing data buffered in lp */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
