svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
strlen(3c)
strlen(3C) Standard C Library Functions strlen(3C)
NAME
strlen, strnlen, strnlen_s - string length operations
SYNOPSIS
#include <string.h>
size_t strlen(const char *s);
size_t strnlen(const char *s, size_t n);
C11 Bounds Checking Interface
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
size_t strnlen_s(const char *s, size_t maxsize);
DESCRIPTION
These functions calculate the length in bytes of strings (arrays of
characters). Depending on the function, strings may be either termi‐
nated by a null character or bounded by a maximum length of n bytes.
They are designed for use with encodings representing each character as
a single byte, and all character counts are measured in individual
bytes, even if a string with multibyte characters is used. They do not
check for null pointers, and programs may crash if passing null or oth‐
erwise invalid pointers to these functions.
strlen(), strnlen()
The strlen() function returns the number of bytes in s, not including
the terminating null character.
The strnlen() function returns the smaller of n or the number of bytes
in s, not including the terminating null character. The strnlen() func‐
tion never examines more than n bytes of the string pointed to by s.
C11 Bounds Checking Interface
The strnlen_s() function is part of the C11 bounds checking interfaces
specified in the C11 standard, Annex K. Each of these functions pro‐
vides similar functionality to their respective non-bounds checking
counterpart functions, but with additional safety checks in the form of
explicit runtime constraints as defined in the C11 standard. See run‐
time_constraint_handler(3C) and INCITS/ISO/IEC 9899:2011.
The strnlen_s() function returns zero if s is a null pointer. Other‐
wise, the number of bytes preceding the terminating null character is
returned. If there is no terminating null character in the first max‐
size characters pointed to by s, strnlen_s() returns maxsize. There are
no defined error conditions in which strnlen_s() will invoke the run‐
time constraint handler.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelAsync-Signal-
Safe _ StandardSee below
Standard
See standards(7) for descriptions of the following standards:
tab() box; cw(2.44i) |cw(3.06i) lw(2.44i) |lw(3.06i) INTERFACESAPPLICA‐
BLE STANDARDS _ strlen()T{
C89 through C11,
POSIX.1-1990 through 2008,
SUS through SUSv4,
XPG1 through XPG7
T} _ strnlen()T{
POSIX.1-2008,
SUSv4,
XPG7
T} _ strlen_s()C11 Annex K
SEE ALSO
string(3C), wcslen(3C), attributes(7), standards(7)
HISTORY
The strlen_s() function was added to Oracle Solaris in the Solaris
11.4.0 release.
The strnlen() function was added to Oracle Solaris in the Solaris
11.0.0 release.
The strlen() function has been included in all Sun and Oracle releases
of Solaris.
Oracle Solaris 11.4 28 Feb 2022 strlen(3C)