/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function wmemcpy(wchar_t*, const wchar_t*, 
                                                                   size_t).
   This copies the specified number of characters from string2 to string1.
*/
#include <wchar.h>
#include <stdlib.h>

int main() {
    wchar_t str1[100], str2[100];
    char *line;
    wchar_t  *retval;
    size_t count;
    int len;

    line ="How are you today?";
    count =11;
    len = strlen(line);
    mbstowcs(str2, line,len);
    retval = wmemcpy(str1,str2,count);
    if(retval != NULL) {
    	printf("Original string: ");
    	fputws(str2, stdout);
    	printf("\nNumber of characters to copy: %d", count);
    	printf("\nCopied string: ");
    	fputws(str1, stdout);
    	fputs("\n", stdout);
    }
    else
        printf("Error\n");
}

