/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/*  This is an example of wmemset(wchar_t*, wchar_t, size_t).  This function
    copies the specified wide character into the first n positions of str1.
*/
#include <wchar.h>
#include <stdlib.h>

int main() {
    int len;
    size_t count;        
    wchar_t *retval, str1[100], c;
    char *line;
    c='r';
    count = 10;

    line = "Hello how are you today?";
    len = strlen(line);
    mbstowcs(str1, line, len);
    retval = wmemset(str1,c, count);
    if(retval != NULL) {
    	printf("Original string: %s\n", line);
    	printf("Character to replace with: ");
    	fputwc(c, stdout);
    	printf("\nThe number of characters to replace: %d\n", count);
    	printf("The new string is: ");
    	fputws(retval, stdout);
    	fputs("\n", stdout);
    }
    else
        printf("Error\n");
}

