The IDL_BasicTypeConversion() function provides general purpose type conversion:

IDL_VPTR IDL_BasicTypeConversion(int argc, IDL_VPTR argv[] int type)

where:

argc

The number of IDL_VPTRs contained in argv.

If argc is 1, this function returns a pointer to a temporary VARIABLE containing the value of argv[0] converted to the type specified by the type argument. If the variable is already of the correct type, the variable itself is returned.

argv

An array of pointers to VARIABLE arguments.

If argv > 1, thenargv[1] is taken to be an offset into the variable specified by argv[0] and following arguments are taken as the dimensions to be used for the result. In this case, enough bytes are copied (starting from the offset) to satisfy the requirements of the dimensions given. This second form does not work for variables of type string, and if argv> 1 an error is generated when argv[0] is of string type. You should ensure that variables of appropriate type are used with this function.

type

The desired type code of the result. See Type Codes.

Note: The IDL BYTE and STRING system routines (implemented by the IDL_CvtByte() and IDL_CvtString() functions, described below) treat conversions between variables of type byte and string in a special way. IDL_BasicTypeConversion() does not handle this special case. Instead, it performs a straightforward type conversion between those types.