WSTransferToEndOfLoopbackLink (C 函数)

int WSTransferToEndOfLoopbackLink(WSLINK d,WSLINK s)

把回环链接 s 中的完整内容传递到目标链接 d.

更多信息

  • sd 应该是不同的.
  • s 必须是回环链接,d 可以是回环链接或一个普通链接.
  • 若发生错误,则 WSTransferToEndOfLoopbackLink() 返回0;若函数成功,则返回非零值.
  • WSTP 的标头文件 wstp.h 已对 WSTransferToEndOfLoopbackLink() 作出声明.

范例

基本范例  (1)

#include "wstp.h"

/* build up an expression on a loopback link and send that expression to a second link */

void f(WSLINK lp1, WSLINK lp2)
{
    if(! WSPutFunction(lp1, "EvaluatePacket", 1))
        { /* unable to put the function to lp1 */ }

    if(! WSPutFunction(lp1, "ToExpression", 1))
        { /* unable to put the function to lp1 */ }

    if(! WSPutString(lp1, "a = Table[Random[Integer, 11],{12}];", 36))
        { /* unable to put the string to lp1 */ }

    if(! WSEndPacket(lp1))
        { /* unable to send the end-of-packet indicator to lp1 */ }

    if(! WSFlush(lp1))
        { /* unable to flush any outgoing data buffered in lp1 */ }

    if(! WSTransferToEndOfLoopbackLink(lp2, lp1))
        { /* unable to transfer all the data from lp1 to lp2 */ }
}