STRNLEN

Section: Linux Programmer's Manual (3)
Updated: 2020-12-21
Index JM Home Page
 

名前

strnlen - 固定長の文字列の長さを調べる  

書式

#include <string.h>

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

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

strnlen():

glibc 2.10 以降:
_POSIX_C_SOURCE >= 200809L
glibc 2.10 より前:
_GNU_SOURCE
 

説明

The strnlen() function returns the number of bytes in the string pointed to by s, excluding the terminating null byte ('\0'), but at most maxlen. In doing this, strnlen() looks only at the first maxlen characters in the string pointed to by s and never beyond s[maxlen-1].  

返り値

The strnlen() function returns strlen(s), if that is less than maxlen, or maxlen if there is no null terminating ('\0') among the first maxlen characters pointed to by s.  

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース 属性 値
strnlen() Thread safety MT-Safe
 

準拠

POSIX.1-2008.  

関連項目

strlen(3)  

この文書について

この man ページは Linux man-pages プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は https://www.kernel.org/doc/man-pages/ に書かれている。

関連キーワード

pointed   strnlen   terminating   first   characters   固定   size   検査   マクロ   要件   macros   number   bytes   excluding   byte   most   doing   looks   never   beyond   maxlen   less   there   among   用語

Linux マニュアル 一覧

関連するコマンド・関数

initstate_r.3   random_r.3   setstate_r.3   srandom_r.3   crypt.3   crypt_r.3
 

Index

名前
書式
説明
返り値
属性
準拠
関連項目
この文書について

This document was created by man2html, using the manual pages.
Time: 04:39:12 GMT, October 11, 2026