GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::wmemcpy(3) C++ Standard Libary std::wmemcpy(3)

std::wmemcpy - std::wmemcpy


Defined in header <cwchar>
wchar_t* wmemcpy( wchar_t* dest, const wchar_t* src, std::size_t count );


Copies exactly count successive wide characters from the wide character array
pointed to by src to the wide character array pointed to by dest. If the objects
overlap, the behavior is undefined. If count is zero, the function does nothing.


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 is std::strncpy, not std::strcpy.


This function is not locale-sensitive and pays no attention to the values of the
wchar_t objects it copies: nulls as well as invalid characters are copied too.

// Run this code


#include <iostream>
#include <cwchar>
#include <clocale>
#include <locale>


int main(void)
{
wchar_t from1[] = L"नमस्ते";
const size_t sz1 = sizeof from1 / sizeof *from1;
wchar_t from2[] = L"Բարև";
const size_t sz2 = sizeof from2 / sizeof *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::cout.imbue(std::locale("en_US.utf8"));
std::wcout << "Wide array contains: ";
for(size_t n = 0; n < sizeof to / sizeof *to; ++n)
if(to[n])
std::wcout << to[n];
else
std::wcout << "\\0";
std::wcout << '\n';
}


Wide array contains: नमस्ते\0Բարև\0


strncpy copies a certain amount of characters from one string to another
(function)
copies a certain amount of wide characters between two, possibly
wmemmove overlapping, arrays
(function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.