STRLEN(3) BSD Programmer's Manual STRLEN(3)
strlen, strnlen - find length of a string
#include <string.h> size_t strlen(const char *s); size_t strnlen(const char *s, size_t maxlen);
The strlen() function computes the length of the string s. The strnlen() function computes the length of the string s, up to maxlen characters. The strnlen() function will never attempt to address more than maxlen characters, making it suitable for use with character arrays that are not guaranteed to be NUL-terminated.
The strlen() function returns the number of characters that precede the terminating NUL character. The strnlen() function returns the number of characters that precede the terminating NUL or maxlen, whichever is smaller.
The strlen() function conforms to ANSI X3.159-1989 ("ANSI C"). The strlen() and strnlen() functions conform to IEEE Std 1003.1-2008 ("POSIX").
The strlen() function first appeared in the Programmer's Workbench (PWB/UNIX) and was ported to Version 7 AT&T UNIX. The strnlen() function appeared in glibc 2.0 and was reimplemented for OpenBSD 4.8. MirOS BSD #10-current November 30, 2014 1
Generated on 2016-04-09 18:24:16 by $MirOS: src/scripts/roff2htm,v 1.83 2016/03/26 23:38:28 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002–2016 The MirOS Project, Germany.
This product includes material provided by mirabilos.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.