Name

wcsset - sets all the characters of the wide-character string to the specified wide-char.

Library

libc.lib

Synopsis

  #include <wchar.h>
  wchar_t* wcsset (wchar_t *wcs, wchar_t wc);

Detailed description

The wcsset() function sets all the characters of the wide-character string wcs to the wide-character specified by wc, except the terminating null character. It returns a pointer to the altered string, which is same as the source string passed to wcsset as it is modified in place.

Return values

The wcsset() returns a pointer to the altered string, on success, else it returns NULL pointer.

Examples

#include <wchar.h>
/* Illustrates how to use wcsset API */
int example_wcsset(void)
{ 
  /* input string which needs to be set to the character specified by wc. */
  wchar_t wcs[9]=L"kohinoor";
  wcgar_t wc = L’K’;
 
  /* expected result string */
  wchar_t *exp=L"KKKKKKKK";
 
  wchar_t *res = NULL;
    
  /* function call to set all the chars in wcs to wc*/
  res = wcsset(wcs, wc);
  /* compare res string with exp string, if they are equal then return 0, else return -1 */
  if( res != NULL && !wcscmp(res,exp))
        return 0;
  else
        return -1;
}

         


See also

strset, wcsnset

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top