Names specified here
Name Description Notes Source Availability
strlen() Compute length of string (·) <string.h> C89 C90 C95 C99 C11
strnlen_s() Compute length of string ? (·) <string.h> C11
wcslen() Compute length of wide-character string (·) <wchar.h> C95 C99 C11
wcsnlen_s() Compute length of wide-character string ? (·) <wchar.h> C11
#include <string.h>
size_t strlen(const char *s);
#define __STDC_WANT_LIB_EXT1__ 1
#include <string.h>
size_t strnlen_s(const char *s, size_t n);
#include <wchar.h>
size_t wcslen(const wchar_t *s);
#define __STDC_WANT_LIB_EXT1__ 1
#include <wchar.h>
size_t wcsnlen_s(const wchar_t *s, size_t n);

These functions compute the length of a string of bytes or wide characters starting at s by finding the position of the first null terminator, and returning it. strnlen_s and wcsnlen_s only search the first n elements, and return n if no null character is found. Also, strnlen_s(NULL, anything) and wcsnlen_s(NULL, anything) return zero.

Note that strlen and strnlen_s count bytes, not multibyte characters.


CHaR
Sitemap Supported
Site format updated 2024-06-05T22:37:07.391+0000
Data updated 1970-01-01T00:00:00.000+0000
Page updated 2022-06-17T21:43:05.000+0000