strcat, wcscat (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Append a string.

char *strcat( char *strDestination, const char *strSource);wchar_t *wcscat( wchar_t *strDestination, const wchar_t *strSource);


  • strDestination
    Null-terminated destination string.
  • strSource
    Null-terminated source string.

Return Values

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


These functions are supported by all versions of the C run-time libraries.

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. No overflow checking is performed when strings are copied or appended. The behavior of strcat is undefined if the source and destination strings overlap.

wcscat is the wide-character version of strcat. The arguments and return value of wcscat are wide-character strings. These two functions behave identically otherwise.

The first argument, strDestination, must be large enough to hold the current strDestination and strSource combined and a closing '\0'; otherwise, a buffer overrun can occur.

This can lead to a denial of service attack against the application if an access violation occurs, or in the worst case, allow an attacker to inject executable code into your process. This is especially true if strDestination is a stack-based buffer. Consider using strncat or wcsncat, or consider using an appropriate strsafe function.

For more information, see Safe String Functions.

The following table shows generic-text routine mappings for this function.

TCHAR.H Routine _UNICODE Defined
_tcscat wcscat

For more information about TCHAR.H routines, see Generic Text Mappings.



This program uses strcpy and strcat to build a phrase.


#include <string.h>
#include <stdio.h>

void main( void )
   char string[80];
   strcpy( string, "Hello world from " );
   strcat( string, "strcpy " );
   strcat( string, "and " );
   strcat( string, "strcat!" );
   printf( "String = %s\n", string );
// Output
String = Hello world from strcpy and strcat!


OS Versions: Windows CE 2.0 and later.

Header: stdio.h, string.h.

Link Library: coredll.dll.

See Also

strncat | strncmp | strncpy

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.