bas7advr.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
StringLength Routine Details
◄Syntax► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
The StringLength routine is used in mixed-language programming. A non-
BASIC routine uses StringLength to find the number of characters in a
BASIC variable-length string.
length = StringLength(string-descriptor%);
■ The preceding syntax is for the C language.
■ For C, MASM, Pascal, and FORTRAN examples, see Chapter 13,
"Mixed-Language Programming with Far Strings" in the Programmer's Guide.
Usage Notes
■ Calls to the StringLength routine are usually made from a non-BASIC
routine.
║ Note: If you are not doing mixed-language programming, there is
║ usually no reason to use StringLength. Instead, use LEN to
║ find the length of a variable-length string.
■ As an example, assume that a MASM routine takes a pointer to a
string descriptor as a parameter. MASM can find the length of the
string data by using the following code:
.model
extrn stringlength: far
.code
mov ax, psdparm ; offset of descriptor
push ax
call stringlength
The length of the string is returned in AX.
■ For detailed instructions on mixed-language programming with strings,
see Chapter 12, "Mixed-Language Programming" and Chapter 13,
"Programming with Near Strings" in the Programmer's Guide.