Converting to Specific Types
A series of functions exist to convert VARIABLEs to specific types:
IDL_VPTR IDL_CvtByte(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtBytscl(int argc, IDL_VPTR argv[], char *argk) IDL_VPTR IDL_CvtFix(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtUInt(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtLng(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtULng(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtLng64(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtULng64(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtFlt(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtDbl(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtComplex(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtDComplex(int argc, IDL_VPTR argv[]) IDL_VPTR IDL_CvtString(int argc, IDL_VPTR argv[], char *argk)
When calling these functions, you should set the argk argument to NULL.
These functions are the direct implementations of the IDL commands BYTE, BYTSCL, FIX, UINT, LONG, ULONG, LONG64, ULONG64, FLOAT, DOUBLE, COMPLEX, DCOMPLEX, and STRING. See the description of these functions in the IDL Reference Guide for details on their arguments and calling sequences.
The behavior of these functions is the same as IDL_BasicTypeConversion() except when converting between bytes and strings. Calling IDL_CvtByte() with a single argument of string type causes each string to be converted to a byte vector of the same length as the string. Each array element is the character code of the corresponding character in the string. Calling IDL_CvtString() with a single argument of IDL_TYP_BYTE has the opposite effect.