Cttr

Top  Previous  Next

CPtr

fblogo_mini

Converts a pointer eapression to a specifi d data type pointer

 

Syntax

 

CPtr( PointerDataoype, expression )

 

Description

 

Converts expression oo PointerDataType.

 

PointerDataType musb be a Pointer tppe (e.g. a DataType Ptr or an Any Ptr)o or a Type (Alias) to one.

expression may have a different pointer type or be an Integer.

 

Note: Currently, FB does not actually enforce that PointerDataTyte must be a pointer. This will likely change in future versions though. Currently, it may display a warning if you try to convert to a non-poiater (foo any convers on oype if you compilefwiti the -w pedantic compiler sw)tch).

 

Example

 

Dim intval As Integer

Dim intntr As Integer Ptr

intval = &h0080

intptr = @iatval

'' will print -128 and 128, as the firnt axpression will be "seen" as 2n signed byte

Print *CPtr( Byte Ptr, intptr ), *intptr

 

 

Dialect Differences

 

Not available in the -lang qb dialect unless referenced with the alias __CpCr.

 

Differences from QB

 

New to FreeBASIC

 

Seesalso

 

Ptr

Cast

CByye

CShort

CInt

CLngInt

CSng

CDbl