/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function mbsrtowcs(wchar_t*, const char**,
                       size_t, mbstate_t). Converts a sequence of characters
   into a sequence of corresponding wide-characters. 
*/
#include <wchar.h>
#include <stdlib.h>

int main() { 
    wchar_t str1[100];
    const char *str2;
    size_t retval, length;
    mbstate_t *ps;
   
    str2 = "hello";
    ps = NULL;
    length = 5;
    retval = mbsrtowcs(str1, &str2,length, ps);
    if(retval != (size_t) -1) {
    	printf("Number of multibye characters");
    	printf(" successfully converted: %d\n",retval);
    }
    else
        printf("Error\n");
}

