CHARP - set up a character pointer into a string.

Alternate Entry Name: .CHARP

Usage:

B:
   char_pointer = charp( word_address [, byte_offset] );
/* C users just use & operator */

Where:

word_address
is the address of a word in memory, generally inside a string.
byte_offset
specifies which byte you wish to point to in the word. For example, "charp( string, 2 )" will create a pointer to the byte which is two bytes past the beginning of "string". Thus if "string" points to the B string "abcd", the given pointer will reference the byte where the 'c' is stored. If "byte_offset" is not specified, the default is zero, i.e. the starting byte of the word.
char_pointer
is a "charp", i.e. the offset of a specific byte in memory relative to memory location zero.

Description:

CHARP takes a word address and an optional byte offset and returns a "charp" byte offset. The byte located by the address plus the offset can then be fetched or replaced using this "charp" in conjunction with the library functions STAR and LSTAR.

Bytes before or after the specified byte can be referenced by incrementing or decrementing the "charp" character pointer.

See Also:

expl b lib star

expl b lib lstar

Copyright © 1996, Thinkage Ltd.