OBSOLETE WSTP C FUNCTION

MLGetType()
This feature is not supported on the Wolfram Cloud.

has been replaced by .

int MLGetType(MLINK link)
gets the type of the current object on the MathLink connection specified by link.

DetailsDetails

  • Unlike MLGetNext(), MLGetType() does not advance to the next object on link, so it can be safely called more than once for the same object.
  • The following types can be returned:
  • MLTKERRerror
    MLTKINTinteger
    MLTKFUNCcomposite function
    MLTKREALapproximate real number
    MLTKSTRcharacter string
    MLTKSYMsymbol
    MLTKOLDINTinteger from older versions of the MathLink library
    MLTKOLDREALapproximate real number from older versions of the MathLink library
    MLTKOLDSTRcharacter string from older versions of the MathLink library
    MLTKOLDSYMsymbol from older versions of the MathLink library
    MLTKOPTSTRcharacter string from newer versions of the MathLink library
    MLTKOPTSYMsymbol from newer versions of the MathLink library
  • MLTKINT and MLTKREAL do not necessarily signify numbers that can be stored in C int and double variables.
  • MLGetType() is declared in the MathLink header file mathlink.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "mathlink.h"

/* read the type of the expression from a link */

void f(MLINK lp)
{
    switch(MLGetType(lp))
    {
        case MLTKINT:
            /* read the integer */
        case MLTKREAL:
            /* read the floating point number */
        case MLTKSTR:
            /* read the string. */

        /* ... */
    }
}