|
SOLUTIONS
|
MATHEMATICA MATHLINK C FUNCTION
MLGetInteger32()
int MLGetInteger32(MLINK link, int *i)
gets a 32-bit integer from the MathLink connection specified by link and stores it in i.
DetailsDetails
- If the data on the link corresponds to a real number, MLGetInteger32() 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 MLGetInteger32() will fail, and return 0.
- You can get arbitrary-precision integers by first using IntegerDigits to generate lists of digits, then calling MLGetInteger32List().
- MLGetInteger32() returns a nonzero value if the function succeeds.
- Use MLError() to retrieve the error code if MLGetInteger32() fails.
- MLGetInteger32() is declared in the MathLink header file mathlink.h.
ExamplesExamplesopen allclose all
Basic Examples (1)Basic Examples (1)
#include "mathlink.h"
/* read a 32-bit integer from a link */
void f(MLINK lp)
{
int data;
if(! MLGetInteger32(lp, &data))
{ /* unable to read an integer from lp */ }
/* use the integer */
}
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »
