Internationalization and localization tools


Locale-Sensitive Windows C++ Functions

LPTSTR StrNCat(LPTSTR pszFront, LPCTSTR pszBack, int cchMax);

LPSTR StrNCatA(LPSTR pszFront, LPCSTR pszBack, int cchMax);

LPWSTR StrNCatW(LPWSTR pszFront, LPCWSTR pszBack, int cchMax);

Internationalization (I18n) Function Overview

The StrNCat function appends a maximum of cchMax characters from the beginning of pszBack to the end of pszFront, returning a pointer to the modified string. The caller must ensure that pszFront is large enough to hold the combined strings and the terminating null character.

StrNCatA is the narrow version of the function; its arguments and return are single-byte or multibyte strings, and cchMax is a byte size.

StrNCatW is the wide version of the function; its arguments and return are wide-character strings, and cchMax is a wide-character size.

I18n Issues

Use the appropriate version of the function as required for internationalization support, ensuring that cchMax is set 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 StrNCat is called, use the Generic version of the function rather than explicitly calling the narrow or wide versions. StrNCat will be mapped to StrNCatW when the program is compiled with the #define UNICODE switch, and to StrNCatA 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

 

Lingoport internationalization and localization services and software