WSPutInteger32 (C Function)

int WSPutInteger32(WSLINK link,int i)

puts the 32-bit integer i to the WSTP connection specified by link.

Details

  • WSPutInteger32() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSPutInteger32() fails.
  • You can send arbitrary-precision integers to the Wolfram Language by giving lists of digits, then converting them to numbers using FromDigits.
  • WSPutInteger32() is declared in the WSTP header file wstp.h.

Examples

Basic Examples  (1)

#include "wstp.h"

/* send the expression Times[10,30] to a link */

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

    if(! WSPutInteger32(lp, 10))
        { /* unable to send the integer to lp */ }

    if(! WSPutInteger32(lp, 30))
        { /* unable to send the integer to lp */ }

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

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