Syntax
#include <wchar.h> wchar_t *wcswcs(const wchar_t *string1, const wchar_t *string2);Description
wcswcs locates the first occurrence of string2 in the wide-character string pointed to by string1. In the matching process, wcswcs ignores the wchar_t null character that ends string2.
wcswcs returns a pointer to the located string or NULL if the string is not found. If string2 points to a string with zero length, wcswcs returns string1.
This example finds the first occurrence of the wide character string pr in buffer1.
#include <stdio.h> #include <wchar.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); return 0; /**************************************************************************** The output should be: The first occurrence of pr in 'computer program' is 'program' ****************************************************************************/ }Related Information