Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.3 KiB

  1. /***
  2. *wcsnset.c - set first n wide-characters to single wide-character
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * defines _wcsnset() - sets at most the first n characters of a
  8. * wchar_t string to a given character.
  9. *
  10. *Revision History:
  11. * 09-09-91 ETC Created from strnset.c.
  12. * 04-07-92 KRS Updated and ripped out _INTL switches.
  13. * 04-06-93 SKS Replace _CRTAPI* with __cdecl
  14. * 02-07-94 CFW POSIXify.
  15. *
  16. *******************************************************************************/
  17. #ifndef _POSIX_
  18. #include <cruntime.h>
  19. #include <string.h>
  20. /***
  21. *wchar_t *_wcsnset(string, val, count) - set at most count characters to val
  22. *
  23. *Purpose:
  24. * Sets the first count characters of string the character value.
  25. * If the length of string is less than count, the length of
  26. * string is used in place of n (wide-characters).
  27. *
  28. *Entry:
  29. * wchar_t *string - string to set characters in
  30. * wchar_t val - character to fill with
  31. * size_t count - count of characters to fill
  32. *
  33. *Exit:
  34. * returns string, now filled with count copies of val.
  35. *
  36. *Exceptions:
  37. *
  38. *******************************************************************************/
  39. wchar_t * __cdecl _wcsnset (
  40. wchar_t * string,
  41. wchar_t val,
  42. size_t count
  43. )
  44. {
  45. wchar_t *start = string;
  46. while (count-- && *string)
  47. *string++ = (wchar_t)val;
  48. return(start);
  49. }
  50. #endif /* _POSIX_ */