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