1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
11 .TH STRNLEN 3 2011-09-28 "GNU" "Linux Programmer's Manual"
13 strnlen \- determine the length of a fixed-size string
16 .B #include <string.h>
18 .BI "size_t strnlen(const char *" s ", size_t " maxlen );
22 Feature Test Macro Requirements for glibc (see
23 .BR feature_test_macros (7)):
32 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
42 function returns the number of characters in the string
43 pointed to by \fIs\fP, excluding the terminating null bye (\(aq\\0\(aq),
44 but at most \fImaxlen\fP.
47 looks only at the first
48 \fImaxlen\fP characters at \fIs\fP and never beyond \fIs+maxlen\fP.
52 function returns \fIstrlen(s)\fP, if that is less than
53 \fImaxlen\fP, or \fImaxlen\fP
54 if there is no null byte (\(aq\\0\(aq) among the first
55 \fImaxlen\fP characters pointed to by \fIs\fP.