/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* a sample program that converts the first 4 characters
in the multibyte character pointed by mb and puts the result
in str. */
#include <wchar.h>
#include <stdlib.h>

int main() {
    char s[] = "This is a test";
    wchar_t pwcs[20];
    size_t n;
  
    n = strlen(s)+1; 
    printf("Original string: %s\n", s);
    printf("Number of characters to convert: %d\n", n);  
    if(mbstowcs(pwcs,s,n) == -1) {
        printf("error convert\n");   
        exit(1);
    }
    printf("The converted characters are: ");
    fputws(pwcs, stdout);
    fputs("\n", stdout); 
}
