Locale-Sensitive Windows C++ Function
int lstrlen(LPCTSTR lpString);
int lstrlenA(LPCSTR lpString);
int lstrlenW(LPCWSTR lpString);
Internationalization (I18n) Function Overview
The lstrlen function returns the length of lpString , not including
the null-terminator.
lstrlenA is the narrow version of the function; its argument is a multibyte string and return length is in bytes.
lstrlenW is the wide version of the function; with a wide-character string argument and return length in WCHAR values.
I18n Issues
Use the appropriate version of the function as required for internationalization support, ensuring that
that the returned length is interpreted correctly for the chosen platform; bytes for the narrow version and
WCHARs for the wide version.
See Locale-Sensitive Length Functions for a discussion on multibyte
and wide character sizes.
Recommended Replacements*
Due to the security risks of this function, consider using a safe string function.
If lstrlen is called, use the Generic version of the function rather than explicitly calling the narrow or wide versions. lstrlen
will be mapped to lstrlenW when the program is compiled with the #define UNICODE switch, and to lstrlenA otherwise.
Using the Generic version facilitates switching between an MBCS and UTF-16 Unicode application.
These are shown as the first choices in the following table:
*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.
Locale-Sensitive Windows C++ Functions
|