MLTransferExpression (C 函数)
MLTransferExpression 已经被 WSTransferExpression 所取代.
更多信息

- dst 与 src 不必是不同的.
- dst 与 src 可以是回环或普通的链接.
- MLTransferExpression() 在错误事件中返回0,如果函数成功则返回非零值.
- MLTransferExpression() 常用于从链接中读取一个表达式以便于把它存在回环链接中.
- MLTransferExpression() 在 MathLink 的标头文件 mathlink.h 中被声明.
范例
基本范例 (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 */ }
}