/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function wcspbrk(const wchar_t*, const wchar_t).
   Returns a pointer to the first character in string1 that also belongs to 
   string2.
*/
#include <wchar.h>
#include <stdlib.h>

int main() { 
    wchar_t str1[100], str2[100];        
    char *line, *line2;
    wchar_t  *retval;
    int len1, len2;
    line = "Today is a very fine day.\n"; 
    line2 ="abc";
    len1 = strlen(line);
    len2 = strlen(line2);

    mbstowcs(str1, line, len1);   
    mbstowcs(str2, line2, len2);   
    retval = wcspbrk(str1,str2);
    fputs("Original: ", stdout);
    fputws(str1, stdout);
    fputs("Characters to search for: ", stdout);
    fputws(str2, stdout);
    fputs("\nFirst occurrence of a character belonging to string2: ", stdout);
    fputws(retval, stdout);
    fputs("\n", stdout);     
}

