The wcsncpy() function is defined in cwchar.h header file. The wcsncpy() function copies a specified number of wide characters from source to destination.
wchar_t *wcsncpy(wchar_t *dest, const wchar_t *src, size_t n);
Parameters: This method accepts the following three parameters:
- dest: specifies the pointer to the destination array.
- src: specifies the pointer to the source array.
- n: represents the number of character to copy.
Return Value: This function returns the modified destination.
Below programs illustrate the above function:-
Destination string is : A Computer Science
Destination string is : Geeks
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- wcstok() function in C++ with example
- wcsstr() function in C++ with example
- ftell() in C with example
- fseek() in C/C++ with example
- asin() and atan() functions in C/C++ with Example
- Comparator function of qsort() in C
- Bind function and placeholders in C++
- strftime() function in C/C++
- std::gcd | C++ inbuilt function for finding GCD
- Power Function in C/C++
- Understanding ShellExecute function and it's application to open a list of URLs present in a file using C++ code
- wcscpy() function in C++ with Examples
- wcscmp() function in C++ with Examples
- strtoul() function in C/C++
- div() function in C++
- strrchr() function in C/C++
- strchr() function in C++ and its applications
- asctime() function in C++
- is_trivial function in C++
- Measure execution time of a function in C++
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.