Namespaces
Variants

std:: wcscpy

From cppreference.net
헤더 파일에 정의됨 <cwchar>
wchar_t * wcscpy ( wchar_t * dest, const wchar_t * src ) ;

src 가 가리키는 와이드 문자열(종료 널 와이드 문자 포함)을 dest 가 가리키는 와이드 문자 배열로 복사합니다.

문자열이 겹치는 경우, 동작은 정의되지 않습니다.

목차

매개변수

dest - 복사 대상 와이드 문자 배열에 대한 포인터
src - 복사할 null 종료 와이드 문자열에 대한 포인터

반환값

dest

예제

#include <clocale>
#include <cwchar>
#include <iostream>
#include <memory>
int main()
{
    const wchar_t* src = L"犬 means dog";
//  src[0] = L'狗'; // can't modify string literal
    auto dst = std::make_unique<wchar_t[]>(std::wcslen(src) + 1); // +1 for the null
    std::wcscpy(dst.get(), src);
    dst[0] = L'狗';
    std::setlocale(LC_ALL, "en_US.utf8");
    std::wcout.imbue(std::locale(""));
    std::wcout << src << '\n' << dst.get() << '\n';
}

출력:

犬 means dog
狗 means dog

참고 항목

한 문자열에서 다른 문자열로 지정된 개수의 와이드 문자를 복사합니다
(함수)
겹치지 않는 두 배열 간에 지정된 개수의 와이드 문자를 복사합니다
(함수)
한 문자열을 다른 문자열로 복사합니다
(함수)