Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C Amendment |
both |
#include <wchar.h>
wchar_t *wcswcs(const wchar_t *string1, const wchar_t *string2);
Locates the first occurrence in the string pointed to by string1 of the sequence of wide characters (excluding the terminating wide NULL character) in the string pointed to by string2.
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, wcswcs() returns a pointer to the located string.
If string2 points to a string with zero length, wcswcs() returns string1.
If the string is not found, wcswcs() returns NULL.
⁄* CELEBW26
This example finds the first occurrence of the wide character string pr
in buffer1, using wcswcs().
*⁄
#include <stdio.h>
#include <wcstr.h>
#define SIZE 40
int main(void)
{
wchar_t buffer1[SIZE] = L"computer program";
wchar_t *ptr;
wchar_t *wch = L"pr";
ptr = wcswcs( buffer1, wch );
printf( "The first occurrence of %ls in '%ls' is '%ls'\n",
wch, buffer1, ptr );
}
The first occurrence of pr in 'computer program' is 'program'