/* Copyright (c) 2001-2004 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function wcsspn(const wchar_t*, const wchar_t*). 
   This returns the length of the substring found in str1.
*/
#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, how are you?";
    line2 = "hel";
    len1 = strlen(line);
    len2 = strlen(line2);
    mbstowcs(str1, line, len1);
    mbstowcs(str2, line2, len2);
    fputs("String: ", stdout);
    fputws(str1, stdout);
    fputs("\nSubstring to search for: ", stdout);
    fputws(str2, stdout);  
    retval = wcsspn(str1, str2);
    printf("\nThe length of the substring is:  %d\n", retval);
}

