C Standard Libraries C++

wcscpy()

Declaration

wchar_t* wcscpy(wchar_t* wpDestString, const wchar_t* kwpSrcString);

Description

This function copies a null-terminated, wide-character array string from the array "kwpSrcString" into the array given by "wpDestString," along with a null-terminator. The array "wpDestString" must be long enough to hold the source string "kwpSrcString" and the null-terminator. The function returns a pointer that is equal to the value of "wpDestString."

Example

#include <cwchar>

int main()
{
    wchar_t waSource[] = L"XoaX.net";
    wchar_t waDestination[20];

    // Copy the source string to the destination
    wcscpy(waDestination, waSource);
    wprintf(L"Destination now holds %ws\n", waDestination);

    // Keep the window open until "Enter" is pressed
    getwchar();
    return 0;
}

Output

wcscpy() Output
 

© 2007–2022 XoaX.net LLC. All rights reserved.