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

  1. /***
  2. *wcschr.c - search a wchar_t string for a given wchar_t character
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       defines wcschr() - search a wchar_t string for a wchar_t character
  8. *
  9. *******************************************************************************/
  10.  
  11.  
  12. #include <cruntime.h>
  13. #include <string.h>
  14.  
  15. /***
  16. *wchar_t *wcschr(string, c) - search a string for a wchar_t character
  17. *
  18. *Purpose:
  19. *       Searches a wchar_t string for a given wchar_t character,
  20. *       which may be the null character L'\0'.
  21. *
  22. *Entry:
  23. *       wchar_t *string - wchar_t string to search in
  24. *       wchar_t c - wchar_t character to search for
  25. *
  26. *Exit:
  27. *       returns pointer to the first occurence of c in string
  28. *       returns NULL if c does not occur in string
  29. *
  30. *Exceptions:
  31. *
  32. *******************************************************************************/
  33.  
  34. wchar_t * __cdecl wcschr (
  35.         const wchar_t * string,
  36.         wchar_t ch
  37.         )
  38. {
  39.         while (*string && *string != (wchar_t)ch)
  40.                 string++;
  41.  
  42.         if (*string == (wchar_t)ch)
  43.                 return((wchar_t *)string);
  44.         return(NULL);
  45. }
  46.  
  47.