Code:
#dim all 'PBCC Test.bas type TestType pArryA as string ptr pArryB as string ptr end type #include "PtrStrArray.inc" global gtTest as TestType function pbmain() local i as long call SetUp() call RedimA(gtTest) ''' must be called ''' byval ''' ? psaUBound( byval gtTest.pArryA ) call RedimB(gtTest) ? psaUBound( byval gtTest.pArryB ) [email protected][9] = "test A1" ? [email protected][9] [email protected][4] = "test B1" ? [email protected][4] psaIncr( byval gtTest.pArryA ) ? psaUBound( byval gtTest.pArryA ) ? [email protected][9] psaDecr( byval gtTest.pArryA ) ? psaUBound( byval gtTest.pArryA ) ? [email protected][9] for i=1 to psaUBound( byval gtTest.pArryB ) psaSet byval gtTest.pArryB, i, "Test B1 " + str$(i) next i for i=0 to psaUBound( byval gtTest.pArryB ) ? psaGet(byval gtTest.pArryB, i) next i ? "done..." waitkey$ end function ' -------------------------------------------------- sub SetUp() ''' notice that these are local arrays ''' ''' works same if changed to global static A() as string : redim A() static B() as string : redim B() gtTest.pArryA = varptr(A()) gtTest.pArryB = varptr(B()) end sub ' -------------------------------------------------- ' -------------------------------------------------- sub RedimA( tType as TestType ) psaReDim( byval tType.pArryA, 9 ) end sub ' -------------------------------------------------- ' -------------------------------------------------- sub RedimB( tType as TestType ) psaReDim( byval tType.pArryB, 5 ) end sub ' --------------------------------------------------
------------------
Leave a comment: