Syntax
#include <wchar.h> wchar_t *wcschr(const wchar_t *string, wchar_t character);Description
wcschr searches the wide-character string for the occurrence of the wide character. The wide character can be a wchar_t null character (\0); the wchar_t null character at the end of string is included in the search.
wcschr operates on null-terminated wchar_t strings. The string argument to this function should contain a wchar_t null character marking the end of the string.
wcschr returns a pointer to the first occurrence of character in string. If the character is not found, a NULL pointer is returned.
This example finds the first occurrence of the character p in the wide-character string "computer program".
#include <stdio.h> #include <wchar.h> #define SIZE 40 int main(void) { wchar_t buffer1[SIZE] = L"computer program"; wchar_t *ptr; wchar_t ch = L'p'; ptr = wcschr(buffer1, ch); printf("The first occurrence of %lc in '%ls' is '%ls'\n", ch, buffer1, ptr); return 0; /**************************************************************************** The output should be: The first occurrence of p in 'computer program' is 'puter program' ****************************************************************************/ }Related Information