C++ wcsncpy() Function

#include<iostream>
#include<cwchar>
using namespace std;
int main()
{
    wchar_t str[50], an[50], ch[50];

    cout << "Enter A String : ";
    wcin >> str;
    cout << endl;

    wcsncpy(an, str, 50);

    wcsncpy(ch, an, 5);

    ch[5] = L'\0';

    wcout << str << endl << endl << an << endl << endl << ch << endl;

    return 0;
}

Comments