Skip to content

Latest commit

 

History

History
103 lines (80 loc) · 4.52 KB

strcat-wcscat-mbscat.md

File metadata and controls

103 lines (80 loc) · 4.52 KB
description title ms.date api_name api_location api_type topic_type f1_keywords helpviewer_keywords ms.assetid
Learn more about: strcat, wcscat, _mbscat
strcat, wcscat, _mbscat
11/04/2016
_mbscat
wcscat
strcat
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-multibyte-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
ntoskrnl.exe
DLLExport
apiref
_mbscat
_ftcscat
_tcscat
strcat
wcscat
concatenating strings
mbscat function
_ftcscat function
_tcscat function
ftcscat function
strcat function
strings [C++], appending
_mbscat function
tcscat function
strings [C++], concatenating
appending strings
wcscat function
c89c4ef1-817a-44ff-a229-fe22d06ba78a

strcat, wcscat, _mbscat

Appends a string. More secure versions of these functions are available; see strcat_s, wcscat_s, _mbscat_s.

Important

_mbscat_s cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported in Universal Windows Platform apps.

Syntax

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
);
template <size_t size>
char *strcat(
   char (&strDestination)[size],
   const char *strSource
); // C++ only
template <size_t size>
wchar_t *wcscat(
   wchar_t (&strDestination)[size],
   const wchar_t *strSource
); // C++ only
template <size_t size>
unsigned char *_mbscat(
   unsigned char (&strDestination)[size],
   const unsigned char *strSource
); // C++ only

Parameters

strDestination
Null-terminated destination string.

strSource
Null-terminated source string.

Return value

Each of these functions returns the destination string (strDestination). No return value is reserved to indicate an error.

Remarks

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.

Important

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. The arguments and return value of _mbscat are multibyte-character strings. These three functions behave identically otherwise.

In C++, these functions have template overloads that invoke the newer, secure counterparts of these functions. For more information, see Secure template overloads.

Generic-text routine mappings

TCHAR.H routine _UNICODE and _MBCS not defined _MBCS defined _UNICODE defined
_tcscat strcat _mbscat wcscat

Requirements

Routine Required header
strcat <string.h>
wcscat <string.h> or <wchar.h>
_mbscat <mbstring.h>

For more compatibility information, see Compatibility.

Example

See the example for strcpy.

See also

String manipulation
strncat, _strncat_l, wcsncat, _wcsncat_l, _mbsncat, _mbsncat_l
strncmp, wcsncmp, _mbsncmp, _mbsncmp_l
strncpy, _strncpy_l, wcsncpy, _wcsncpy_l, _mbsncpy, _mbsncpy_l
_strnicmp, _wcsnicmp, _mbsnicmp, _strnicmp_l, _wcsnicmp_l, _mbsnicmp_l
strrchr, wcsrchr, _mbsrchr, _mbsrchr_l
strspn, wcsspn, _mbsspn, _mbsspn_l