Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C Amendment |
both |
#include <wchar.h>
wchar_t *wcschr(const wchar_t *string1, wchar_t character);
Searches string for the occurrence of character. The character may be a wide NULL character (\0). The wide NULL character at the end of string is included in the search. The wcschr() function operates on NULL-terminated wide-character strings. The argument to this function must contain a wide NULL character marking the end of the string.
The behavior of this wide-character function is affected by the LC_CTYPE category of the current locale. If you change the category, undefined results can occur.
If successful, wcschr() returns a pointer to the first occurrence of character in string.
If the character is not found, wcschr() returns a NULL pointer.
⁄* CELEBW05
This example finds the first occurrence of the character p in
the wide character string "computer program" using &wcschr..
*⁄
#include <stdio.h>
#include <wchar.h>
#define SIZE 40
int main(void)
{
wchar_t buffer1[SIZE] = L"computer program";
wchar_t * ptr;
wint_t ch = L'p';
ptr = wcschr( buffer1, ch );
printf( "The first occurrence of %lc in '%ls' is '%ls'\n",
ch, buffer1, ptr );
}
The first occurrence of p in 'computer program' is 'puter program'