WSPutInteger8 (C Function)

int WSPutInteger8(( WSLINK l , unsigned char i )

puts the 8-bit integer i to the WSTP connection specified by l.

Details

  • WSPutInteger8() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutInteger8() fails.
  • WSPutInteger8() is declared in the WSTP header file wstp.h.

Examples

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