|
SOLUTIONS
|
MLPutByteString()
int MLPutByteString(MLINK link, const unsigned char *s, int n)
s の場所から始まるn 文字の文字列をlink で指定されたMathLink 接続に置く.
詳細詳細
- 文字列中のすべての文字は,Mathematica のToCharacterCode から得られる文字コードを使って指定されたものでなければならない.
- したがって,改行は\nではなく,原始文字コードを使って指定されなければならない.
- MLPutByteString()はコードが256未満の文字しか扱わない.
- 通常のASCII文字はもちろん,ISO ラテン-1 文字も扱える.
- MLPutByteString()はエラーがあると0を返し, 関数が成功すると0以外の値を返す.
- MLError() を使うと,MLPutByteString()が不成功の場合にエラーコードを引き出すことができる.
- MLPutByteString()はMathLink ヘッダファイルmathlink.hの中で宣言される.
例題例題すべて開くすべて閉じる
例 (1)例 (1)
#include "mathlink.h"
/* transfer a string from a source link to a destination link */
void f(MLINK sourcelink, MLINK destinationlink)
{
const unsigned char *string;
int length;
if(! MLGetByteString(sourcelink, &string, &length, 0))
{ /* unable to get the string from sourcelink */ }
if(! MLPutByteString(destinationlink, string, length))
{ /* unable to put the string to destination link */ }
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
