WSTransferExpression (C 函数)
更多信息
- dst 与 src 不必是不同的.
- dst 与 src 可以是回环或普通的链接.
- 若发生错误,则 WSTransferExpression() 返回0;若函数成功,则返回非零值.
- WSTransferExpression() 常用于从链接中读取一个表达式以便于把它存在回环链接中.
- 对于 dst WSTransferExpression() 传递了 (WSLINK)0 ,src 上的表达式被忽略.
- WSTransferExpression() 在 WSTP 头文件 wstp.h 中声明.
范例
基本范例 (1)
#include "wstp.h"
/* transfer an expression to link 2 from loopback link 1 */
void f(WSLINK lp2, WSLINK lp1)
{
/* send EvaluatePacket[ToExpression[str]] to lp1 */
if(! WSPutFunction(lp1, "EvaluatePacket", 1))
{ /* unable to put function to lp1 */ }
if(! WSPutFunction(lp1, "ToExpression", 1))
{ /* unable to put function to lp1 */ }
if(! WSPutString(lp1, "a = Table[RandomInteger[2,12]];"))
{ /* unable to put the string to lp1 */ }
if(! WSEndPacket(lp1))
{ /* unable to put the end-of-packet indicator to lp1 */ }
if(! WSFlush(lp1))
{ /* unable to put flush any outgoing data buffered in lp1 */ }
/* now transfer to lp2 from lp1 */
if(! WSTransferExpression(lp2, lp1))
{ /* unable to transfer an expression from lp1 to lp2 */ }
}
参见
相关指南
历史
1996年引入 (3.0) | 在以下年份被更新:2007 (6.0)