wmemset() — Set Wide Character Buffer to a Value

Format

#include <wchar.h>
wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);

Language Level: ANSI

Threadsafe: Yes.

Wide Character Function: See Wide Characters for more information.

Description

The wmemset() function copies the value of c into each of the first n wide characters of the object pointed to by s. If n has the value 0, the wmemset() function copies 0 wide characters.

Return Value

The wmemset() function returns the value of s.

Example that uses wmemset()

This example sets the first 6 wide characters to the wide character 'A'.

#include <wchar.h>
#include <stdio.h>
 
void main()
{
   wchar_t *in = L"1234ABCD";
   wchar_t *ptr;
 
   printf("\nEXPECTED: AAAAAACD");
   ptr = wmemset(in, L'A', 6);
   if (ptr == in)
      printf("\nResults returned - %ls \n", ptr);
   else
      {
      printf("\n** ERROR ** wrong pointer returned\n");
      }
}

Related Information



[ Top of Page | Previous Page | Next Page | Contents | Index ]