safec  3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
wcscat_s.c File Reference
#include "safe_str_lib.h"
+ Include dependency graph for wcscat_s.c:

Functions

EXPORT errno_t wcscat_s (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src)
 The wcscat_s function appends a copy of the wide string pointed to by src (including the terminating null character) to the end of the wide string pointed to by dest. More...
 

Function Documentation

◆ wcscat_s()

EXPORT errno_t wcscat_s ( wchar_t *restrict  dest,
rsize_t  dmax,
const wchar_t *restrict  src 
)

The wcscat_s function appends a copy of the wide string pointed to by src (including the terminating null character) to the end of the wide string pointed to by dest.

The initial wide character from src overwrites the null character at the end of dest.

All elements following the terminating null wide character (if any) written by wcscat_s in the array of dmax characters pointed to by dest take unspeciļ¬ed values when wcscat_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with 0.

Remarks
SPECIFIED IN
  • C11 standard (ISO/IEC 9899:2011): K.3.7.2.1 The wcscat_s function (p: 617-618) http://en.cppreference.com/w/c/string/wide/wcscat
  • ISO/IEC TR 24731, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
[out]destpointer to wide string that will be extended by src if dmax allows. The wide string is null terminated. If the resulting concatenated wide string is less than dmax, the remaining slack space is nulled.
[in]dmaxrestricted maximum length of the resulting dest, including the null
[in]srcpointer to the wide string that will be concatenaed to string dest
Precondition
Neither dest nor src shall be a null pointer
dmax shall not equal zero
dmax shall not be greater than RSIZE_MAX_WSTR
dmax shall be greater than wcsnlen_s(src,m).
Copying shall not take place between objects that overlap
Note
C11 uses RSIZE_MAX, not RSIZE_MAX_WSTR.
Returns
If there is a runtime-constraint violation, then if dest is not a null pointer and dmax is greater than zero and not greater than RSIZE_MAX_WSTR, then wcscat_s nulls dest.
Return values
EOKwhen successful operation, all the wide characters from src were appended to dest and the result in dest is null terminated.
ESNULLPwhen dest or src is a NULL pointer
ESZEROLwhen dmax = 0
ESLEMAXwhen dmax > RSIZE_MAX_WSTR
ESUNTERMwhen dest not terminated in the first dmax wide characters
ESOVRLPwhen src overlaps with dest
See also
wcscat_s(), strcpy_s(), strncpy_s()