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

  1. /***
  2. *mbsnextc.c - Get the next character in an MBCS string.
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       To return the value of the next character in an MBCS string.
  8. *
  9. *******************************************************************************/
  10.  
  11. #ifdef _MBCS
  12.  
  13. #include <cruntime.h>
  14. #include <mbdata.h>
  15. #include <mbctype.h>
  16. #include <mbstring.h>
  17.  
  18.  
  19. /***
  20. *_mbsnextc:  Returns the next character in a string.
  21. *
  22. *Purpose:
  23. *       To return the value of the next character in an MBCS string.
  24. *       Does not advance pointer to the next character.
  25. *
  26. *Entry:
  27. *       unsigned char *s = string
  28. *
  29. *Exit:
  30. *       unsigned int next = next character.
  31. *
  32. *Exceptions:
  33. *
  34. *******************************************************************************/
  35.  
  36. unsigned int __cdecl _mbsnextc(
  37.     const unsigned char *s
  38.     )
  39. {
  40.         unsigned int  next = 0;
  41.  
  42.         if (_ISLEADBYTE(*s))
  43.             next = ((unsigned int) *s++) << 8;
  44.  
  45.         next += (unsigned int) *s;
  46.  
  47.         return(next);
  48. }
  49.  
  50. #endif  /* _MBCS */
  51.