WSPutByteSymbol (C 函数)

int WSPutByteSymbol(WSLINK link,const unsigned char *s,long l)

把由长度为 l 的字符字符串 s 给定名称的符号写入由 link 指定的 WSTP 连接.

更多信息

  • WSPutByteSymbol() 可以8比特传递所有字符.
  • 字符字符串不需要使用零字节结尾.
  • 若发生错误,则 WSPutByteSymbol() 返回0;若函数成功,则返回非零值.
  • 如果 WSPutByteSymbol() 失败,则使用 WSError() 检索错误代码.
  • WSTP 的标头文件 wstp.h 已对 WSPutByteSymbol() 作出声明.

范例

基本范例  (1)

#include "wstp.h"

/* send the expression Integrate[Cos[y],y] to a link */

void f(WSLINK lp)
{
    if(! WSPutFunction(lp, "Integrate", 2))
        { /* unable to put the function to lp */ }

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

    if(! WSPutByteSymbol(lp, "y", 1))
        { /* unable to put the symbol to lp */ }

    if(! WSPutByteSymbol(lp, "y", 1))
        { /* unable to put the symbol to lp */ }

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

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