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::wmemset(3) C++ Standard Libary std::wmemset(3)

std::wmemset - std::wmemset


Defined in header <cwchar>
wchar_t* wmemset( wchar_t* dest, wchar_t ch, std::size_t count );


Copies the wide character ch into each of the first count wide characters of the
wide character array pointed to by dest.


If overflow occurs, the behavior is undefined.


If count is zero, the function does nothing.


dest - pointer to the wide character array to fill
ch - fill wide character
count - number of wide characters to fill


Returns a copy of dest


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

// Run this code


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


int main()
{
wchar_t ar[4] = {L'1', L'2', L'3', L'4'};
std::wmemset(ar, L'\U0001f34c', 2); // replaces [12] with the 🍌 bananas
std::wmemset(ar+2, L'蕉', 2); // replaces [34] with the 蕉 bananas


std::setlocale(LC_ALL, "en_US.utf8");
std::wcout.imbue(std::locale("en_US.utf8"));
std::wcout << std::wstring(ar, 4) << '\n';
}


🍌🍌蕉蕉


memset fills a buffer with a character
(function)
copies a certain amount of wide characters between two non-overlapping
wmemcpy arrays
(function)
fill_n copy-assigns the given value to N elements in a range
(function template)

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.