INtime SDK Help
strlen, strnlen, strnlen_s, wcslen, wcsnlen, wcsnlen_s

Gets the length of a null-terminated string.

#include <string.h

size_t strlen(const char *string);
size_t strnlen(const char *string, rsize_t maxsize);
size_t strnlen_s(const char *string, rsize_t maxsize);

#include <wchar.h>
        
size_t wcslen(const wchar_t *string);
size_t wcsnlen(const wchar_t *string, size_t maxsize);
size_t wcsnlen_s(const wchar_t *string, size_t maxsize);

Parameters

string
String to find length of.
maxsize
The size in characters of the string buffer.

Remarks

Each of these functions returns the length in chacaters of string, not including the null terminating character.

strnlen is not intended to be a replacement for strlen; strnlen is intended to be used only to calculate the size of incoming untrusted data in a buffer of known size.

strnlen and wcsnlen do not validate their parameters; if string is NULL an access violation occurs.

strnlen_s and wcsnlen check their parameters. If string is NULL then these functions return 0.

Return Values

The string length in characters of string, not including the terminating null character.
Success.
No error return.
Failure.

Generic Text Routines

tchar.h routine _UNICODE not defined _UNICODE defined
_tcslen strlen wcslen
_tcsnlen strnlen wcsnlen
_tcsnlen_s strnlen_s wcsnlen_s

Requirements

Versions Defined in Include Link to
INtime 3.0
INtime 6.0 (for wide-character and generic text versions)
intime/rt/include/string.h
intime/rt/include/wchar.h
intime/rt/include/tchar.h
strlen.h
wchar.h
tchar.h
clib.lib