WSPutByteSymbol (C Function)

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

puts a symbol whose name is given by the character string s of length l to the WSTP connection specified by link.

Details

  • WSPutByteSymbol() can transfer the full range of characters representable in 8 bits.
  • The character string does not need to be terminated with a null byte.
  • WSPutByteSymbol() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutByteSymbol() fails.
  • WSPutByteSymbol() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (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 */ }
}