STRPTR function

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


 Syntax 1:

 RetLPSTR = STRPTR(MainStr$)

 Parameters:

  • RetLPSTR Returned 32 bit pointer to the string address. RetLPSTR must be dimensioned as a LPSTR(long pointer to a string).
  • StrVar$ String variable of which address is to be determined.

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 VARIABLES and CONST's as STRINGS
 '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 PRINT $pA ' Displays "Hello!"
 PRINT $pB ' Displays "ello!"