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

int main() { 
    wchar_t nptr[100];
    wchar_t *endptr;        
    int base, len;
    long retval;
    char *line;

    line= "-10110134932This stopped it"; 
    base = 10;
    len = strlen(line); 
    mbstowcs(nptr, line, len);
    fputs("Original string: ", stdout);
    fputws(nptr, stdout);
    printf("\nLong integer representation in base %d : ", base);
    retval = wcstol(nptr, &endptr, base);
    printf("%ld\n", retval);
}

