Appendix A: System Routines — Strings
995
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
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.
Inputs:
str
— Character string.
Outputs:
Length of the string pointed to by
str.
Assumptions:
None
Side Effects:
None
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
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); /* find length of string in handle */
lStr2 = strlen((char *)pStr2); /* length of string to append */
lBuf = lStr1 + lStr2 + 1; /* calc new space requirement */
if (HeapRealloc(hStr1, lBuf) == 0) /* try to get new space */
ER_throw(ER_MEMORY);
pStr1 = (UCHAR *)HeapDeref(hStr1) + lStr1; /* point to end of original string */
memcpy(pStr1, pStr2, lStr2+1); /* append new string */
}