man.bsd.lv manual page server

Manual Page Search Parameters

STRLEN(3) Library Functions Manual STRLEN(3)

strlen, strnlenfind length of a string

#include <string.h>

size_t
strlen(const char *s);

size_t
strnlen(const char *s, size_t maxlen);

The () function computes the length of the string s.

The () 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.

wcslen(3)

The strlen() function conforms to ANSI X3.159-1989 (“ANSI C89”).

The strlen() and strnlen() functions conform to IEEE Std 1003.1-2008 (“POSIX.1”).

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.

December 9, 2014 OpenBSD-7.0