OpenersNotesSection(Spacer1)Details

MLGetIntegerList() allocates memory for the array of integers. You must call (NonWLLink[MLDisownIntegerList(), paclet:ref/c/MLDisownIntegerList]) to disown this memory. If MLGetIntegerList() fails and the function's return value indicates an error, do not call (NonWLLink[MLDisownIntegerList(), paclet:ref/c/MLDisownIntegerList]) on the contents of a.

MLGetIntegerList() returns immutable data.

MLGetIntegerList() returns 0 in the event of an error, and a nonzero value if the function succeeds.

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

MLGetIntegerList() is declared in the MathLink header file (RefLink[mathlink.h, paclet:ref/file/mathlink.h]).

MLGetIntegerList() is equivalent to (NonWLLink[MLGetInteger32List(), paclet:ref/c/MLGetInteger32List]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* read a list of integers from a link */

void f(MLINK lp)
{
	int *data;
	long length;

	if(! MLGetIntegerList(lp, &data, &length))
		{
			/* unable to read the integer list from lp */
			return;
		}

	/* ... */

	MLDisownIntegerList(lp, data, length);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLGetIntegerArray(), paclet:ref/c/MLGetIntegerArray])  ▪  (NonWLLink[MLGetByteString(), paclet:ref/c/MLGetByteString])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})