/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function wcscspn(const wchar_t*, const wchar_t*).     
   This finds a substring.  The function returns the length of the first 
   substring that is made up of characters from string 2.
*/
#include <wchar.h>
#include <stdlib.h>

int main() { 
    char *line, *line2;
    wchar_t str1[100], str2[100];        
    size_t retval;
    int len1,len2;
    line = "hello";
    line2 = "ll";

    len1 = strlen(line);
    len2 = strlen(line2);
    mbstowcs(str1, line,len1);
    mbstowcs(str2, line2, len2);  
    retval = wcscspn(str1, str2);
    printf("Substring starts at position:  %d\n", retval);
}
