Hello Folks,
I'm having trouble using a pointer to a UDT. The UDT is defined in an *.inc file and so is the pointer declaration, as per:
Then in the main program I have:
The code doesn't appear to be working. All the UDT elements hold the same value as gGdPtr. IOW, the values @gGdPtr.DataPtr and @gGdPtr.CellPtr and @gGdPtr.ColPtr and @gGdPtr.RowPtr and gGdPtr are equal, as is every other element.
What am I doing wrong?
Pat
I'm having trouble using a pointer to a UDT. The UDT is defined in an *.inc file and so is the pointer declaration, as per:
Code:
GLOBAL gGdPtr AS GridDetails POINTER ' Pointer to GridDetails
Then in the main program I have:
Code:
'====================================================================================== ' Start by allocating GridDetails memory. gGdPtr = Malloc( SIZEOF( GridDetails ) ) ' Allocate GridDetails memory IF ISFALSE gGdPtr THEN EXIT FUNCTION ' No memory, bail '====================================================================================== ' We now need separate memory blocks for the following arrays: string Data; ' Cell Attributes; Colunm Details; and Row Details. @gGdPtr.DataPtr = Malloc( 4 ) ' Memory for one pointer @gGdPtr.CellPtr = Malloc( SIZEOF( CellAttributes ) * 1 )' Cell attributes @gGdPtr.ColPtr = Malloc( SIZEOF( ColDetails ) * 1 ) ' Column Details @gGdPtr.RowPtr = Malloc( SIZEOF( RowDetails ) * 1 ) ' Row Details
What am I doing wrong?
Pat
Comment