home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / wcspbrk.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  55 lines

  1. /***
  2. *wcspbrk.c - scans wide character string for a character from control string
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines wcspbrk()- returns pointer to the first wide-character in
  8. *       a wide-character string in the control string.
  9. *
  10. *******************************************************************************/
  11.  
  12.  
  13. #include <cruntime.h>
  14. #include <string.h>
  15.  
  16. /***
  17. *wchar_t *wcspbrk(string, control) - scans string for a character from control
  18. *
  19. *Purpose:
  20. *       Returns pointer to the first wide-character in
  21. *       a wide-character string in the control string.
  22. *
  23. *Entry:
  24. *       wchar_t *string - string to search in
  25. *       wchar_t *control - string containing characters to search for
  26. *
  27. *Exit:
  28. *       returns a pointer to the first character from control found
  29. *       in string.
  30. *       returns NULL if string and control have no characters in common.
  31. *
  32. *Exceptions:
  33. *
  34. *******************************************************************************/
  35.  
  36. wchar_t * __cdecl wcspbrk (
  37.         const wchar_t * string,
  38.         const wchar_t * control
  39.         )
  40. {
  41.         wchar_t *wcset;
  42.  
  43.         /* 1st char in control string stops search */
  44.         while (*string) {
  45.             for (wcset = (wchar_t *) control; *wcset; wcset++) {
  46.                 if (*wcset == *string) {
  47.                     return (wchar_t *) string;
  48.                 }
  49.             }
  50.             string++;
  51.         }
  52.         return NULL;
  53. }
  54.  
  55.