function
<cwchar>
wmemset
wchar_t* wmemset (wchar_t* ptr, wchar_t wc, size_t num);
Fill array of wide characters
Sets the first num elements of the array of wide characters pointed by ptr to the value specified as wc.
This is the wide character equivalent of memset (<cstring>).
Parameters
- ptr
- Pointer to the array to fill.
- wc
- Value to be set.
- num
- Number of bytes to be set to the value.
size_t is an unsigned integral type.
Return Value
ptr is returned.
Example
1 2 3 4 5 6 7 8 9 10
|
/* wmemset example */
#include <wchar.h>
int main ()
{
wchar_t wcs[] = L"almost every programmer should know wmemset!";
wmemset (wcs,L'-',6);
wprintf (L"%ls\n",wcs);
return 0;
}
|
Output:
------ every programmer should know wmemset!
|
See also
- memset
- Fill block of memory (function
)
- wmemcpy
- Copy block of wide characters (function
)
- wcsncpy
- Copy characters from wide string (function
)
- wmemcmp
- Compare two blocks of wide characters (function
)