Syntax
#include <wchar.h> wchar_t *wcscpy(wchar_t *string1, const wchar_t *string2);Description
wcscpy copies the contents of string2 (including the ending wchar_t null character) into string1.
wcscpy operates on null-terminated wchar_t strings; string arguments to this function should contain a wchar_t null character marking the end of the string. Boundary checking is not performed.
wcscpy returns a pointer to string1.
This example copies the contents of source to destination.
#include <stdio.h> #include <wchar.h> #define SIZE 40 int main(void) { wchar_t source[SIZE] = L"This is the source string"; wchar_t destination[SIZE] = L"And this is the destination string"; wchar_t *return_string; printf("destination is originally = \"%ls\"\n", destination); return_string = wcscpy(destination, source); printf("After wcscpy, destination becomes \"%ls\"\n", return_string); return 0; /**************************************************************************** The output should be: destination is originally = "And this is the destination string" After wcscpy, destination becomes "This is the source string" ****************************************************************************/ }
Related Information