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 .\" Japanese Version Copyright (c) 1999 HANATAKA Shinya
12 .\" all rights reserved.
13 .\" Translated Tue Jan 11 00:55:48 JST 2000
14 .\" by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
16 .TH STRNLEN 3 2010-09-15 "GNU" "Linux Programmer's Manual"
19 .\"O strnlen \- determine the length of a fixed-size string
20 strnlen \- ¸ÇÄêŤÎʸ»úÎó¤ÎŤµ¤òÄ´¤Ù¤ë
24 .B #define _GNU_SOURCE
26 .B #include <string.h>
28 .BI "size_t strnlen(const char *" s ", size_t " maxlen );
32 .\"O Feature Test Macro Requirements for glibc (see
33 .\"O .BR feature_test_macros (7)):
34 glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
35 .RB ( feature_test_macros (7)
44 .\"O Since glibc 2.10:
46 _XOPEN_SOURCE\ >=\ 700 || _POSIX_C_SOURCE\ >=\ 200809L
48 .\"O Before glibc 2.10:
58 .\"O function returns the number of characters in the string
59 .\"O pointed to by \fIs\fP, not including the terminating \(aq\\0\(aq character,
60 .\"O but at most \fImaxlen\fP.
63 .\"O looks only at the first
64 .\"O \fImaxlen\fP characters at \fIs\fP and never beyond \fIs+maxlen\fP.
66 ´Ø¿ô¤Ï \fIs\fP ¤¬»Ø¤¹Ê¸»úÎó¤ÎŤµ¤ò¥Ð¥¤¥È¿ô¤ÇÊÖ¤¹¡£
67 Ťµ¤Ë¤Ï½ªÃ¼¤Î \(aq\\0\(aq ʸ»ú¤ò´Þ¤Þ¤Ê¤¤¡£
68 ¤Þ¤¿Ä¹¤µ¤ÏºÇÂç¤Ç \fImaxlen\fP ¤Þ¤Ç¤Ç¤¢¤ê¡¢
70 ¤Ï \fIs\fP ¤ÎºÇ½é¤Î \fImaxlen\fP ¥Ð¥¤¥È¤Î¤ß¤ò¸¡ºº¤·
71 \fIs+maxlen\fP ¤è¤êÀè¤ò¸¡ºº¤¹¤ë¤³¤È¤Ï¤Ê¤¤¡£
72 .\"O .SH "RETURN VALUE"
76 .\"O function returns \fIstrlen(s)\fP, if that is less than
77 .\"O \fImaxlen\fP, or \fImaxlen\fP
78 .\"O if there is no \(aq\\0\(aq character among the first
79 .\"O \fImaxlen\fP characters pointed to by \fIs\fP.
81 ´Ø¿ô¤Ï \fImaxlen\fP °Ê²¼¤Ê¤é¤Ð \fIstrlen(s)\fP ¤ÈƱ¤¸
82 ÃͤòÊÖ¤¹¡£\fIs\fP ¤Î»Ø¤¹Ê¸»úÎ󤬺ÇÂç \fImaxlen\fP ¥Ð¥¤¥È¤Þ¤Ç¤Ë
83 \(aq\\0\(aq ʸ»ú¤ò´Þ¤Þ¤Ê¤¤¾ì¹ç¤Ë¤Ï \fImaxlen\fP ¤òÊÖ¤¹¡£
84 .\"O .SH "CONFORMING TO"
86 .\"O This function is a GNU extension.
87 ¤³¤Î´Ø¿ô¤Ï GNU ¤Î³ÈÄ¥¤Ç¤¢¤ë¡£
91 .BR feature_test_macros (7)