Appendix A: System Routines — Strings
strlen
Declaration:
size_t strlen (const char * str )
Category(ies):
Strings
Description:
Returns the length in bytes of the string pointed to by str , not counting the
terminating null character.
str — Character string.
Inputs:
Length of the string pointed to by str.
Outputs:
Assumptions:
None
Side Effects:
None
All versions of the TI-89 / TI-92 Plus.
Availability:
TI-89 / TI-92 Plus
Differences:
None
See Also:
strspn, strcspn
Example:
void hStrAppend( HANDLE hStr1, UCHAR *pStr2 )
/* hStrAppend - append string to a handle.
input:
hStr1 = handle to string to be lengthened,
pStr2 = string to append to handle.
*/
{
UCHAR *pStr1;
ULONG lStr1, lStr2, lBuf;
pStr1 = HeapDeref(hStr1);
lStr1 = strlen((char *)pStr1);
lStr2 = strlen((char *)pStr2);
lBuf = lStr1 + lStr2 + 1;
if (HeapRealloc(hStr1, lBuf) == 0)
ER_throw(ER_MEMORY);
pStr1 = (UCHAR *)HeapDeref(hStr1) + lStr1;
memcpy(pStr1, pStr2, lStr2+1);
}
TI-89 / TI-92 Plus Developer Guide
/* find length of string in handle */
/* length of string to append */
/* calc new space requirement */
/* try to get new space */
/* point to end of original string */
/* append new string
Not for Distribution
995
*/
Beta Version January 26, 2001