Tcl_GetIntFromObj

int
Tcl_GetIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, int *valuePtr)

The Tcl_GetIntFromObj function is an accessor/type-mutator for Tcl_Objs that retrieves the integer value stored in the object, objPtr, and writes that value to the variable pointed to by valuePtr. If the content of the object is not integer-numeric, the type will be converted to something that is integral and, if that type conversion fails, an error message will be left in the interp's result. The returned value will be TCL_OK on a successful read (when the value will be stored) or TCL_ERROR on type conversion failure.

See also