WSGetType (C Function)
int WSGetType(WSLINK link)
gets the type of the current object on the WSTP connection specified by link.
Details
- 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.
Examples
Basic Examples (1)
#include "wstp.h"
/* read the type of the expression from a link */
void f(WSLINK lp)
{
switch(WSGetType(lp))
{
case WSTKINT:
/* read the integer */
case WSTKREAL:
/* read the floating point number */
case WSTKSTR:
/* read the string. */
/* ... */
}
}