/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function wcstoul(const wchar_t*, wchar_t**,int). 
   This converts a string to an unsigned long integer in the specified base.
*/
#include <wchar.h>
#include <stdlib.h>

int main() { 
    wchar_t nptr[100], *endptr;
    int base, len;
    unsigned long retval;
    wint_t ch;
    char *line;
 
    line= "10110134932This stopped it";
    len = strlen(line); 
    mbstowcs(nptr, line, len);
    base = 2;
    fputs("Original string: ", stdout);
    fputws(nptr, stdout);
    printf("\nUnsigned long integer representation in base %d : ", base);
    retval = wcstoul(nptr, &endptr, base);
    printf("%ld\n", retval); 
}

