Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,948 questions

51,890 answers

573 users

How to set a wide character buffer to a value in C

1 Answer

0 votes
#include <wchar.h>
#include <stdio.h>

// 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
 
void main()
{
    wchar_t arr[] = L"12345ABCDE";
    wchar_t *ptr;
 
    wchar_t *p = wmemset(arr, L'*', 5);
    
    if (p == arr) {
        printf("%ls\n", p);
    }
    else {
        printf("ERROR\n");
    }
}



/*
run:

*****ABCDE

*/

 



answered Aug 7, 2024 by avibootz

Related questions

1 answer 92 views
92 views asked Aug 7, 2024 by avibootz
1 answer 272 views
1 answer 78 views
1 answer 253 views
1 answer 90 views
90 views asked Aug 7, 2024 by avibootz
...