| 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* wmemcpy(wchar_t* dest,constwchar_t* src,std::size_t count); | ||
Copies exactlycount successive wide characters from the wide character array pointed to bysrc to the wide character array pointed to bydest. If the objects overlap, the behavior is undefined. Ifcount is zero, the function does nothing.
Contents |
| dest | - | pointer to the wide character array to copy to |
| src | - | pointer to the wide character array to copy from |
| count | - | number of wide characters to copy |
dest
This function's analog for byte strings isstd::strncpy, notstd::strcpy.
This function is not locale-sensitive and pays no attention to the values of thewchar_t objects it copies: nulls as well as invalid characters are copied too.
#include <clocale>#include <cwchar>#include <iostream>#include <iterator>#include <locale> int main(void){constwchar_t from1[]= L"नमस्ते";constwchar_t from2[]= L"Բարև";conststd::size_t sz1=std::size(from1);conststd::size_t sz2=std::size(from2);wchar_t to[sz1+ sz2]; std::wmemcpy(to, from1, sz1);// copy from1, along with its null terminator std::wmemcpy(to+ sz1, from2, sz2);// append from2, along with its null terminator std::setlocale(LC_ALL,"en_US.utf8");std::wcout.imbue(std::locale("en_US.utf8"));std::wcout<< L"Wide array contains: ";for(std::size_t n=0; n<std::size(to);++n)if(to[n])std::wcout<< to[n];elsestd::wcout<< L"\\0";std::wcout<< L'\n';}
Possible output:
Wide array contains: नमस्ते\0Բարև\0
| copies a certain amount of characters from one string to another (function)[edit] | |
| copies a certain amount of wide characters between two, possibly overlapping, arrays (function)[edit] | |
C documentation forwmemcpy | |