CRE Programmer's Guide
String and Memory Block Functions
Common Run-Time Environment (CRE) Programmer’s Guide—528146-004
8-25
Strpbrk
•
If the length of source is greater than max_bytes, the functions do not store a
null character.
•
The Strncpy functions copy bytes from source to dest until max_bytes have
been copied or a null byte is encountered in
source:
°
If max_bytes are copied without encountering a null byte in source, does a
null byte is not stored in
dest.
°
If a null byte is encountered in source before max_bytes are copied, the
functions copy the null byte and pad
dest with additional null bytes until a total
of
max_bytes have been written in dest.
Example
STRING .des[0:100];
STRING .src[0:100] := ["HP Computers Incorporated",0];
CALL RTL_Strncpy_(des, src, 6); ! des gets ["HP",0];
Strpbrk
The Strpbrk functions scan a string until they find any character in the string that also
appears in a second string.
str
is a pointer to the string to scan.
stop_chars
is a pointer to the string containing the characters to scan for in str.
Return Value
The Strpbrk functions return the address of the first occurrence in str of any character
in
stop_chars. If str does not contain any of the characters in stop_chars, zero is
returned.
Considerations
Both str and stop_chars must be terminated by a zero (null) byte to stop the scan.
INT PROC RTL_Strpbrk_( str, stop_chars );
STRING .str; ! in
STRING .stop_chars; ! in TNS only
INT(32) PROC RTL_StrpbrkX_( str, stop_chars );
STRING .EXT str; ! in
STRING .EXT stop_chars; ! in TNS only