C examples for wchar.h:wmemchr
function
<cwchar> <wchar.h>
Locate character in block of wide characters
const wchar_t* wmemchr (const wchar_t* ptr, wchar_t wc, size_t num); wchar_t* wmemchr ( wchar_t* ptr, wchar_t wc, size_t num);
Parameter | Description |
---|---|
ptr | Pointer to the array of wchar_t elements. |
wc | Wide character to be located. |
num | Number of elements of type wchar_t to compare. |
A pointer to the first occurrence of found character.
If not found, the function returns a null pointer.
#include <wchar.h> int main ()/* w ww. j ava2 s . c om*/ { wchar_t * pwc; wchar_t wcs[] = L"this is a test, test z"; pwc = wmemchr (wcs, L'z', wcslen(wcs)); if (pwc!=NULL) wprintf (L"'p' found at position %d.\n", pwc-wcs+1); else wprintf (L"'p' not found.\n"); return 0; }