int WSGetType(WSLINK link)
gets the type of the current object on the WSTP connection specified by link.
- Unlike WSGetNext(), WSGetType() 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:
WSTKERR error WSTKINT integer WSTKFUNC composite function WSTKREAL approximate real number WSTKSTR character string WSTKSYM symbol WSTKOLDINT integer from older versions of the WSTP library WSTKOLDREAL approximate real number from older versions of the WSTP library WSTKOLDSTR character string from older versions of the WSTP library WSTKOLDSYM symbol from older versions of the WSTP library WSTKOPTSTR character string from newer versions of the WSTP library WSTKOPTSYM symbol from newer versions of the WSTP library
- WSTKINT and WSTKREAL do not necessarily signify numbers that can be stored in C int and double variables.
- WSGetType() is declared in the WSTP header file wstp.h.
Basic Examples (1)
/* read the type of the expression from a link */
void f(WSLINK lp)
/* read the integer */
/* read the floating point number */
/* read the string. */
/* ... */