BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

kstrlen - return the length of a string

LIBRARY CALL

size_t kstrlen(
   const char *istr)

INPUT

OUTPUT

none

RETURN VALUE

The number of characters in the string. On a NULL input string, a value of 0 is returned.

DESCRIPTION

This routine finds the length of a string. This routine is similiar to the system routine strlen(). It counts the number of characters in a string until it reaches a null ('\\0') character. This routine is better than many standard unix strlen() routines, because it treats a NULL pointer as an empty string, which returns a length of zero.

ADDITIONAL INFORMATION

none

EXAMPLES

This is a very simple example that prints the length of the input string.
char *str = "1234";
kprintf("The length is '%d'\n", kstrlen(str));
The resulting length is 4, because the null terminating character is not counted.

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$BOOTSTRAP/objects/library/kutils/src/strings.c

SEE ALSO

kutils(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.