wcscat() — Append to wide-character string

Standards

Standards / Extensions C or C++ Dependencies

ISO C Amendment
XPG4
XPG4.2
C99
Single UNIX Specification, Version 3

both  

Format

#include <wchar.h>

wchar_t *wcscat(wchar_t * __restrict__string1, const wchar_t * __restrict__string2);

General description

Appends a copy of the string pointed to by string2 to the end of the string pointed to by string1.

The wcscat() function operates on NULL-terminated wide-character strings. The string arguments to this function must contain a wide NULL character marking the end of the string. Bounds checking is not performed.

The behavior of this wide-character function is affected by the LC_CTYPE category of the current locale. If you change the category, undefined results can occur.

Returned value

wcscat() returns the value of string1.

Example

CELEBW04
/* CELEBW04                                      

   This example creates the wide character string "computer                     
   program" using &wcscat..                                                     
                                                                                
 */                                                                             
#include <stdio.h>                                                              
#include <wchar.h>                                                              
                                                                                
#define SIZE 40                                                                 
                                                                                
int main(void)                                                                  
{                                                                               
  wchar_t buffer1[SIZE] = L"computer";                                          
  wchar_t * string      = L" program";                                          
  wchar_t * ptr;                                                                
                                                                                
  ptr = wcscat( buffer1, string );                                              
  printf( "buffer1 = %ls\n", buffer1 );                                         
}                                                                               
Output:
buffer1 = computer program