/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/* This is an example of the function wcschr(const wchar_t*, wchar_t*).  
   This function finds a character in a string.
*/
#include <wchar.h>
#include <stdlib.h>

int main() { 
    wchar_t str[100], c;
    char *line;
    wchar_t *retval;
    int result, len;
    line = "Hello";
    c = 'l'; 
    
    len = strlen(line);
    mbstowcs(str, line, len);
    retval = wcschr(str,c); 
    result = retval - str +1;
    if(result <= 0) {
 	printf("There is no '");
        fputwc(c, stdout);
        printf("' in this string.\n");
    }
    else {
    	printf("The first occurence of '");
        fputwc(c,stdout);
        printf("' is at position: %d\n", result);
    }
}

