wcscspn


wcscspn

Searches for any element of one wide string in another

 #include <wchar.h> size_t wcscspn ( const wchar_t *s1 , const wchar_t *s2  ); 

The wcscspn( ) function returns the number of wide characters at the beginning of the string addressed by s1 that do not match any of the wide characters in the string addressed by s2. In other words, wcscspn( ) returns the index of the first wide character in s1 that matches any wide character in s2. If the two strings have no wide characters in common, then the return value is the length of the string addressed by s1.

Example

 wchar_t *path = L"/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games"; int  separator; wchar_t *basename = L"aprogram"; wchar_t fullname[1024] = L""; separator = wcscspn( path, L":" ); if ( separator > ( sizeof(fullname) - 1 ))   return -1; wcsncpy( fullname, path, separator ); fullname[separator] = '\0'; wcsncat( fullname, L"/", sizeof(fullname) - wcslen(fullname) -1 ); wcsncat( fullname, basename, sizeof(fullname) - wcslen(fullname) -1 ); fputws( fullname, stdout ); 

See Also

wcsspn( ), wcspbrk( ), and wcschr( ); strcspn( ), strspn( ), strpbrk( ), and strchr( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net