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 | |||||||||||||||||||||||||
|
Functions | ||||||||||||||||||||||||||
Character classification | ||||||||||||||||||||||||||
Character manipulation | ||||||||||||||||||||||||||
Conversions to numeric formats | ||||||||||||||||||||||||||
|
| |||||||||||||||||||||||||
String manipulation | ||||||||||||||||||||||||||
String examination | ||||||||||||||||||||||||||
Array manipulation | ||||||||||||||||||||||||||
Defined in header <cwchar> | ||
wchar_t* wcscpy(wchar_t* dest,constwchar_t* src); | ||
Copies the wide string pointed to bysrc (including the terminating null wide character) to wide character array pointed to bydest.
If the strings overlap, the behavior is undefined.
Contents |
dest | - | pointer to the wide character array to copy to |
src | - | pointer to the null-terminated wide string to copy from |
dest
#include <clocale>#include <cwchar>#include <iostream>#include <memory> int main(){constwchar_t* src= L"犬 means dog";// src[0] = L'狗'; // can't modify string literalauto 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';}
Output:
犬 means dog狗 means dog
copies a certain amount of wide characters from one string to another (function)[edit] | |
copies a certain amount of wide characters between two non-overlapping arrays (function)[edit] | |
copies one string to another (function)[edit] | |
C documentation forwcscpy |