OpenersNotesSection(Spacer1)Details

If the data on the link corresponds to a real number, WSGetInteger8() will round it to an integer.

If the data on the link corresponds to an integer too large to store in a C unsigned char on your computer system, then WSGetInteger8() will fail, and return 0.

You can get arbitrary-precision integers by first using (RefLink[IntegerDigits, paclet:ref/IntegerDigits]) to generate lists of digits, and then calling (NonWLLink[WSGetInteger8List(), paclet:ref/c/WSGetInteger8List]).

WSGetInteger8() returns a nonzero function value if the function succeeds.

Use (NonWLLink[WSError(), paclet:ref/c/WSError]) to retrieve the error code if WSGetInteger8() fails.

WSGetInteger8() is declared in the WSTP header file (RefLink[wstp.h, paclet:ref/file/wstp.h]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

/* A function to read an unsigned char from a link */

void f(WSLINK l)
{
	unsigned char c;

	if(! WSGetInteger8(l, &c))
	{ /* Unable to read the integer from l */ }

	/* Use the integer */
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[WSGetInteger16(), paclet:ref/c/WSGetInteger16])  ▪  (NonWLLink[WSGetInteger32(), paclet:ref/c/WSGetInteger32])  ▪  (NonWLLink[WSGetInteger64(), paclet:ref/c/WSGetInteger64])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Portability of WSTP Programs, paclet:tutorial/PortabilityOfWSTPPrograms])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Integers, paclet:guide/WSTPCFunctionsForExchangingIntegers])}})}})