Name
      
      wcsnset - sets first n characters of the wide-character string to the specified wide-char. 
      
      
      
      
         
         Library
      
      
      
      
      libc.lib
      
      
      
      
         
         Synopsis
      
      
      
      
      
      
      
         
            |  | wchar_t*
               
               
               wcsnset (wchar_t *wcs, wchar_t wc, int n); 
 | 
      
      
         
         Detailed description
      
      
      The
      
      
       wcsnset()
      function sets first n characters of the wide-character string
      
      
       wcs
      to the wide-character specified by
      
      
       wc.
      If n is greater than the length of
      
      
       wcs,
      then length of
      
      
       wcs
      is used instead of n.
      It returns a pointer to the altered string, which is same
      as the source string passed to wcsnset as it is modified in place.
      
      
      
      
         
         Return values
      
      
      The
      
      
       wcsnset()
      returns a pointer to the altered string, on success, else it returns NULL pointer.
      
      
      
      
         
         Examples
      
      
      
      
      #include <wchar.h>
/* Illustrates how to use wcsnset API */
int example_wcsnset(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’;
  int n = 3;
 
  /* expected result string */
  wchar_t *exp=L"KKKinoor";
 
  wchar_t *res = NULL;
    
  /* function call to set first n chars in wcs to wc*/
  res = wcsnset(wcs, wc, n);
  /* 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,
      
      
      wcsset
      
      
      Feedback
For additional information or queries on this page send feedback	
      
      
         
         
         
            
               | © 2005-2007 Nokia  | 
 |