Format
#include <wcstr.h> wchar_t *wcswcs(const wchar_t *string1, const wchar_t *string2);
Language Level: XPG4
Threadsafe: Yes.
Description
The wcswcs() function locates the first occurrence of string2 in the wide-character string pointed to by string1. In the matching process, the wcswcs() function ignores the wchar_t null character that ends string2.
Return Value
The wcswcs() function 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.
Example that uses wcswcs()
This example finds the first occurrence of the wide character string pr in buffer1.
#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 ); } /**************** Output should be similar to: ****************** The first occurrence of pr in 'computer program' is 'program' */
Related Information
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.