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

  1. /***
  2. *wcslen.c - contains wcslen() routine
  3. *
  4. *       Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       wcslen returns the length of a null-terminated wide-character string,
  8. *       not including the null wchar_t itself.
  9. *
  10. *******************************************************************************/
  11.  
  12.  
  13. #include <cruntime.h>
  14. #include <string.h>
  15.  
  16. /***
  17. *wcslen - return the length of a null-terminated wide-character string
  18. *
  19. *Purpose:
  20. *       Finds the length in wchar_t's of the given string, not including
  21. *       the final null wchar_t (wide-characters).
  22. *
  23. *Entry:
  24. *       const wchar_t * wcs - string whose length is to be computed
  25. *
  26. *Exit:
  27. *       length of the string "wcs", exclusive of the final null wchar_t
  28. *
  29. *Exceptions:
  30. *
  31. *******************************************************************************/
  32.  
  33. size_t __cdecl wcslen (
  34.         const wchar_t * wcs
  35.         )
  36. {
  37.         const wchar_t *eos = wcs;
  38.  
  39.         while( *eos++ ) ;
  40.  
  41.         return( (size_t)(eos - wcs - 1) );
  42. }
  43.  
  44.