I need (strong want) to access a group or unrelated string arrays
by an index number.
Apparently it is possible to get and save the ptr to an entire
array, e.g.
DIM R(1:4) as string
DIM xptr AS STRING PTR
xptr=VARPTR(R())
but having saved it, what is the syntax to access the elements
of the array,
I've tried several ways. Here's two (commented out lines) that
don't work.
----------------------------------------------------------------
$COMPILE EXE
FUNCTION PrintX(A() AS STRING) AS STRING
FOR i&=1 TO 4:x$=x$+A(i&)+"|":NEXT:MSGBOX x$
END FUNCTION
FUNCTION PBMAIN() AS LONG
DIM R(1:4) AS STRING
R(1)=" String I. ":R(2)=" String II. "
R(3)=" String III. ":R(4)=" String IV. "
DIM xptr AS STRING PTR
xptr=VARPTR(R())
MSGBOX PrintX(R())
'MSGBOX PrintX(xptr) ' This won't work
'FOR i&=1 TO 4:[email protected](i&)+"|":NEXT:msgbox x$ ' Nor does this
MSGBOX "end program"
END FUNCTION
by an index number.
Apparently it is possible to get and save the ptr to an entire
array, e.g.
DIM R(1:4) as string
DIM xptr AS STRING PTR
xptr=VARPTR(R())
but having saved it, what is the syntax to access the elements
of the array,
I've tried several ways. Here's two (commented out lines) that
don't work.
----------------------------------------------------------------
$COMPILE EXE
FUNCTION PrintX(A() AS STRING) AS STRING
FOR i&=1 TO 4:x$=x$+A(i&)+"|":NEXT:MSGBOX x$
END FUNCTION
FUNCTION PBMAIN() AS LONG
DIM R(1:4) AS STRING
R(1)=" String I. ":R(2)=" String II. "
R(3)=" String III. ":R(4)=" String IV. "
DIM xptr AS STRING PTR
xptr=VARPTR(R())
MSGBOX PrintX(R())
'MSGBOX PrintX(xptr) ' This won't work
'FOR i&=1 TO 4:[email protected](i&)+"|":NEXT:msgbox x$ ' Nor does this
MSGBOX "end program"
END FUNCTION
Comment