std:: wcscpy
From cppreference.net
C++
Text processing library
| Localization library | |||||||||||||||||||||||||
| Regular expressions library (C++11) | |||||||||||||||||||||||||
| Formatting library (C++20) | |||||||||||||||||||||||||
| Null-terminated sequence utilities | |||||||||||||||||||||||||
| Byte strings | |||||||||||||||||||||||||
| Multibyte strings | |||||||||||||||||||||||||
| Wide strings | |||||||||||||||||||||||||
| Primitive numeric conversions | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
| Text encoding identifications | |||||||||||||||||||||||||
|
|||||||||||||||||||||||||
Null-terminated wide strings
| Functions | ||||||||||||||||||||||||||
| Character classification | ||||||||||||||||||||||||||
| Character manipulation | ||||||||||||||||||||||||||
| Conversions to numeric formats | ||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||
| String manipulation | ||||||||||||||||||||||||||
| String examination | ||||||||||||||||||||||||||
| Array manipulation | ||||||||||||||||||||||||||
|
ヘッダーで定義
<cwchar>
|
||
|
wchar_t
*
wcscpy
(
wchar_t
*
dest,
const
wchar_t
*
src
)
;
|
||
src が指すワイド文字列(終端のナルワイド文字を含む)を、 dest が指すワイド文字配列にコピーします。
文字列が重なる場合、動作は未定義です。
目次 |
パラメータ
| dest | - | コピー先のワイド文字配列へのポインタ |
| src | - | コピー元のヌル終端ワイド文字列へのポインタ |
戻り値
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
関連項目
|
指定された数のワイド文字をある文字列から別の文字列にコピーする
(関数) |
|
|
指定された数のワイド文字を重複しない2つの配列間でコピーする
(関数) |
|
|
ある文字列を別の文字列にコピーする
(関数) |
|
|
Cドキュメント
for
wcscpy
|
|