wcsncat() function in C/C++ Last Updated : 17 Sep, 2018 Comments Improve Suggest changes Like Article Like Report The wcsncat() function appends the characters of the source to the destination, including a terminating null wide character. If the length of the string in source is less than num. Then only the content up to the terminating null wide character is copied. Syntax: wchar_t* wcsncat (wchar_t* destination, const wchar_t* source, size_t num) Parameters: The function accepts three mandatory parameters which are described below: destination: specifies the pointer to the destination array source: specifies the string to be added to the destination num: specifies the maximum number of character to be added Return value: The function returns the destination. Below programs illustrate the above function: Program 1: CPP // C++ program to illustrate // wcsncat() function #include <bits/stdc++.h> using namespace std; int main() { // maximum length of the destination string wchar_t destination[20]; // maximum length of the source string wchar_t source[20]; // initialize the destination string wcscpy(destination, L"Geekforgeeks "); // initialize the source string wcscpy(source, L"is the best"); // initialize the length of // the resulted string you want wcsncat(destination, source, 20); wprintf(L"%ls\n", destination); return 0; } Output: Geekforgeeks is the best Program 2 : CPP // C++ program to illustrate // wcsncat() function #include <bits/stdc++.h> using namespace std; int main() { // maximum length of the destination string wchar_t destination[40]; // maximum length of the source string wchar_t source[40]; // initialize the destination string wcscpy(destination, L"only some of the "); // initialize the source string wcscpy(source, L"letters will be copied"); // initialize the length of // the resulted string you want wcsncat(destination, source, 20); wprintf(L"%ls\n", destination); return 0; } Output: only some of the letters will be copi Comment More infoAdvertise with us Next Article wcsncat() function in C/C++ A AmanSrivastava1 Follow Improve Article Tags : Misc C Language C++ CPP-Functions C-Library +1 More Practice Tags : CPPMisc Similar Reads wcsncmp() function in C/C++ The wcsncmp() function in C/C++ compare characters of two wide strings. The comparison is done lexicographically. This function takes three arguments lhs, rhs and count. It compares the contents of lhs and rhs lexicographically upto a maximum of count wide characters. Note: The behaviour of wcsncmp( 3 min read strncat() function in C/C++ In C/C++, strncat() is a predefined function used for string handling. string.h is the header file required for string functions.This function appends not more than n characters from the string pointed to by src to the end of the string pointed to by dest plus a terminating Null-character. The initi 4 min read wcstol() function in C/C++ The wcstol() function in C/C++ converts the given wide string to a long integer. This function sets a pointer to point to the first character after the last valid character of the wide string if there is any, otherwise, the pointer is set to null. This function ignores all the leading whitespace cha 3 min read wcstod() function in C/C++ The wcstod() function converts the wide string as a double. This function interprets the contents of a wide string as a floating point number. If endString is not a null pointer, the function also sets the value of endString to point to the first character after the number. Syntax: double wcstod( co 3 min read wcsrchr() function in C/C++ The wcsrchr() function is a builtin function in C/C++ which searches for the last occurrence of a wide character in a wide string. It is defined within the cwchar header file in C++. Syntax: wcsrchr(str, ch) Parameters: The function accepts two parameters which are described below. str: It specifies 2 min read Like