Wolfram Language & System 11.0 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

This feature is not supported on the Wolfram Cloud.

int WSGetInteger32(WSLINK link,int *i)
gets a 32-bit integer from the WSTP connection specified by link and stores it in i.


  • If the data on the link corresponds to a real number, WSGetInteger32() will round it to an integer.
  • If the data on the link corresponds to an integer too large to store in a C int on your computer system, then WSGetInteger32() will fail, and return 0.
  • You can get arbitrary-precision integers by first using IntegerDigits to generate lists of digits, then calling WSGetInteger32List().
  • WSGetInteger32() returns a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSGetInteger32() fails.
  • WSGetInteger32() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* read a 32-bit integer from a link */

void f(WSLINK lp)
    int data;

    if(! WSGetInteger32(lp, &data))
        { /* unable to read an integer from lp */ }

    /* use the integer */