From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/string%2Fwide%2Fwcscat.html | 62 +++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 devdocs/c/string%2Fwide%2Fwcscat.html (limited to 'devdocs/c/string%2Fwide%2Fwcscat.html') diff --git a/devdocs/c/string%2Fwide%2Fwcscat.html b/devdocs/c/string%2Fwide%2Fwcscat.html new file mode 100644 index 00000000..038a0a54 --- /dev/null +++ b/devdocs/c/string%2Fwide%2Fwcscat.html @@ -0,0 +1,62 @@ +

wcscat, wcscat_s

Defined in header <wchar.h>
(1)
wchar_t *wcscat( wchar_t *dest, const wchar_t *src );
+
(since C95)
(until C99)
wchar_t *wcscat( wchar_t *restrict dest, const wchar_t *restrict src );
+
(since C99)
errno_t wcscat_s( wchar_t *restrict dest, rsize_t destsz,
+                  const wchar_t *restrict src );
+
(2) (since C11)
+1) Appends a copy of the wide string pointed to by src to the end of the wide string pointed to by dest. The wide character src[0] replaces the null terminator at the end of dest. The resulting wide string is null-terminated. The behavior is undefined if the destination array is not large enough for the contents of both str and dest and the terminating null wide character. The behavior is undefined if the strings overlap.
+2) Same as (1), except that it may clobber the rest of the destination array (from the last character written to destsz) with unspecified values and that the following errors are detected at runtime and call the currently installed constraint handler function:
+
+
    +
  • src or dest is a null pointer
  • +
  • destsz is zero or greater than RSIZE_MAX/sizeof(wchar_t)
  • +
  • there is no null terminator in the first destsz wide characters of dest
  • +
  • truncation would occur (the available space at the end of dest would not fit every wide character, including the null terminator, of src)
  • +
  • overlap would occur between the source and the destination strings
  • +
+
As with all bounds-checked functions, wcscat_s only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including <wchar.h>.
+
+

Parameters

+ + + +
dest - pointer to the null-terminated wide string to append to
src - pointer to the null-terminated wide string to copy from
destsz - maximum number of characters to write, typically the size of the destination buffer

Return value

+1) returns a copy of dest +
+2) returns zero on success, returns non-zero on error. Also, on error, writes L'\0' to dest[0] (unless dest is a null pointer or destsz is zero or greater than RSIZE_MAX/sizeof(wchar_t)).

Example

#include <wchar.h> 
+#include <stdio.h>
+#include <locale.h>
+ 
+int main(void) 
+{
+    wchar_t str[50] = L"Земля, прощай.";
+    wcscat(str, L" ");
+    wcscat(str, L"В добрый путь.");
+    setlocale(LC_ALL, "en_US.utf8");
+    printf("%ls", str);
+}

Output:

+
Земля, прощай. В добрый путь.

References

See also

+ + + +
+
(C95)(C11)
appends a certain amount of wide characters from one wide string to another
(function)
+
(C11)
concatenates two strings
(function)
+
(C95)(C11)
copies one wide string to another
(function)
C++ documentation for wcscat
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/string/wide/wcscat +

+
-- cgit v1.2.3