STRPTR function

Purpose: STRPTR returns a 32 bit pointer to the string space address.


 Syntax 1:
 RetLPSTR = STRPTR(MainStr$)

 Parameters:

  • StrVar$ String variable of which address is to be determined.

 Return Value:

  • RetLPSTR, the return value, is a 32 bit pointer to the string address. RetLPSTR must be dimensioned as a LPSTR (long pointer to a string).

Example:


 DIM pA AS LPSTR ' allocate a 32 bit string POINTER variable
 DIM pB AS LPSTR ' allocate a 32 bit string POINTER variable

 pA = STRPTR("Hello!") 'pA points to "Hello!"
 pB = pA + 1 'pB points to "ello!" (example of POINTER arithmetic)

 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ' Prepending "$" instructs BCX to treat variable and CONST datatypes as STRINGS
 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 PRINT $pA
 PRINT $pB

Result:

Hello!
ello!