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 1999-07-25 "GNU" "Linux Programmer's Manual"
13 strnlen \- determine the length of a fixed-size string
16 .B #define _GNU_SOURCE
18 .B #include <string.h>
20 .BI "size_t strnlen(const char *" s ", size_t " maxlen );
25 function returns the number of characters in the string
26 pointed to by \fIs\fP, not including the terminating \(aq\\0\(aq character,
27 but at most \fImaxlen\fP.
30 looks only at the first
31 \fImaxlen\fP characters at \fIs\fP and never beyond \fIs+maxlen\fP.
35 function returns \fIstrlen(s)\fP, if that is less than
36 \fImaxlen\fP, or \fImaxlen\fP
37 if there is no \(aq\\0\(aq character among the first
38 \fImaxlen\fP characters pointed to by \fIs\fP.
40 This function is a GNU extension.
43 .BR feature_test_macros (7)