vcanim.gif (8357 bytes)SWU_listToCArray
Home ] Sales ] Products ] Services ] Support ] Downloads ]

 

 


SWU_listToCArray

SWU_listToCArray is a library procedure which allows users to convert Tcl list to a C array of type long, integer, float or double. The input data is a Tcl list's name and a C array type.

package require SWU

SWU_listToCArray Tcl_list C_array_type
Tcl_list
Tcl list, which elements are to be assigned to the elements of the C array. See Tcl documentation regarding Tcl lists.
C_array_type
See C documentation regarding numeric types.

Return Value

If the procedure succeeds then it returns the ID of a C array of type C_array_type filled with values of the Tcl list's elements, otherwise an error message string is returned on the Tk console's command line.

Side Effects

None.

Examples

set varList [list 2.34 3.12 5.34 567.98 456.3]
2.34 3.12 5.34 567.98 456.3
set arrayID [SWU_listToCArray $varList float]
FloatArray1
set arrayID
FloatArray1
puts [access $arrayID 3]
567.98

This example sets the Tcl list varList to the list of numbers, converts varList to a C array of type float, and prints out the fourth element of the C array.

See Also

SWU_cArrayToList

SW_cArrayToTclArray


Behaviors Overview ] Behavior Evaluate ] Behavior Edit ] Debugger ] Console ] Find ] SAA Library ] SW library ] SWC library ] SWN library index ] SWU library ] Attributes Index ] Scripting Examples ]

copyright Video-Collage Inc.