|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
strcat, wcscat, _mbscat
Append a string.
char *strcat( char *strDestination, const char *strSource ); wchar_t *wcscat( wchar_t *strDestination, const wchar_t *strSource ); unsigned char *_mbscat( unsigned char *strDestination, const unsigned char *strSource );
- Null-terminated destination string.
- Null-terminated source string.
Each of these functions returns the destination string (strDestination). No return value is reserved to indicate an error.
The strcat function appends strSource to strDestination and terminates the resulting string with a null character. The initial character of strSource overwrites the terminating null character of strDestination. The behavior of strcat is undefined if the source and destination strings overlap.
Security Note Because strcat does not check for sufficient space in strDestination before appending strSource, it is a potential cause of buffer overruns. Consider using strncat instead.
wcscat and _mbscat are wide-character and multibyte-character versions of strcat. The arguments and return value of wcscat are wide-character strings; those of _mbscat are multibyte-character strings. These three functions behave identically otherwise.
Generic-Text Routine Mappings
|TCHAR.H routine||_UNICODE & _MBCS not defined||_MBCS defined||_UNICODE defined|
|strcat||<string.h>||ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP|
|wcscat||<string.h> or <wchar.h>||ANSI, Win 98, Win Me, Win NT, Win 2000, Win XP|
|_mbscat||<mbstring.h>||Win 98, Win Me, Win NT, Win 2000, Win XP|
For additional compatibility information, see Compatibility in the Introduction.
All versions of the C run-time libraries.
See the example for strcpy.