ECast()

Description

ECast() is used to cast a pointer to a given type and length.

Call Signature

any ptr ECast ( identifier type_name, int elements, any ptr old_ptr )

Return Value

any ptr

The recast pointer.

Arguments

identifier type_name:

The name of the type to be cast to. This can be any basic type, or user defined type.

int elements:

The number of the above items the resulting pointer is considered to be cast to.

any ptr old_ptr:

The data ptr being passed in.

Remarks

The resulting pointer may be assigned to a pointer variable.

Example

The following example assigs a pointer of type BaseClass to an existing SubClass, while perserving the number of objects as 1. Note that a normal assignment of the form 'a=b' is not guaranteed to preserve the object count of 1 since the memory sizes of the two classes could differ.


 local BaseClass ptr a, SubClass ptr b

 b = EAlloc( SubClass, 1 )
 a = ECast( BaseClass, 1, b )

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.