WSPutInteger8 (C 函数)

int WSPutInteger8(( WSLINK l , unsigned char i )

把一个8位整数写入由 l 指定的 WSTP 连接.

更多信息

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

范例

基本范例  (1)

#include "wstp.h"

/* A function to send the expression Plus[3,126] to a link */

void f(WSLINK l)
{
    unsigned char a = 3;
    unsigned char b = 126;

    if(! WSPutFunction(l, "Plus", 2))
    { /* Unable to put the function to the link */ }

    if(! WSPutInteger8(l, a))
    { /* Unable to put the integer 3 to the link */ }

    if(! WSPutInteger8(l, b))
    { /* Unable to put the integer 126 to the link */ }

    if(! WSEndPacket(l))
    { /* Unable to send the end-of-packet indicator to the link */ }

    if(! WSFlush(l))
    { /* Unable to flush the outgoing data to the link */ }
}