WSPutArgCount (C 函数)

int WSPutArgCount(WSLINK link,int n)

指定放在 link 中一个复合函数的自变量数.

更多信息

  • 若发生错误,则 WSPutArgCount() 返回0;若函数成功,则返回非零值.
  • WSPutArgCount() 失败,则使用 WSError() 检索错误代码.
  • WSTP 的标头文件 wstp.h 已对 WSPutArgCount() 作出声明.

范例

基本范例  (1)

#include "wstp.h"

/* send Plus[2,3] over a link */

void f(WSLINK lp)
{
    if(! WSPutType(lp, WSTKFUNC))
        { /* unable to send the function type to lp */ }

    if(! WSPutArgCount(lp, 2))
        { /* unable to put the number of arguments to lp */ }

    if(! WSPutSymbol(lp, "Plus"))
        { /* unable to put the symbol to lp */ }

    if(! WSPutInteger(lp, 2))
        { /* unable to put the integer to lp */ }

    if(! WSPutInteger(lp, 3))
        { /* unable to put the integer to lp */ }

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

    if(! WSFlush(lp))
        { /* unable to flush the link-output buffer */ }
}