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.

73 lines
1.5 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows for Workgroups **/
  3. /** Copyright (C) Microsoft Corp., 1991-1992 **/
  4. /*****************************************************************/
  5. /*
  6. stratol.cxx
  7. NLS/DBCS-aware string class: atol method
  8. This file contains the implementation of the atol method
  9. for the STRING class. It is separate so that clients of STRING which
  10. do not use this member function need not link to it.
  11. FILE HISTORY:
  12. beng 01/18/91 Separated from original monolithic .cxx
  13. beng 02/07/91 Uses lmui.hxx
  14. */
  15. #include "npcommon.h"
  16. extern "C"
  17. {
  18. #include <netlib.h>
  19. #include <stdlib.h>
  20. }
  21. #if defined(DEBUG)
  22. static const CHAR szFileName[] = __FILE__;
  23. #define _FILENAME_DEFINED_ONCE szFileName
  24. #endif
  25. #include <npassert.h>
  26. #include <npstring.h>
  27. /*******************************************************************
  28. NAME: NLS_STR::atol
  29. SYNOPSIS: Returns *this in its long numeric equivalent
  30. ENTRY: With no arguments, parses from beginning of string.
  31. Given an ISTR, starts at that point within the string.
  32. EXIT:
  33. NOTES: Uses C-Runtime atol function
  34. HISTORY:
  35. johnl 11/26/90 Written
  36. beng 07/22/91 Callable on erroneous string; simplified CheckIstr
  37. ********************************************************************/
  38. LONG NLS_STR::atol() const
  39. {
  40. if (QueryError())
  41. return 0;
  42. return ::atol( _pchData );
  43. }
  44. LONG NLS_STR::atol( const ISTR & istrStart ) const
  45. {
  46. if (QueryError())
  47. return 0;
  48. CheckIstr( istrStart );
  49. return ::atol( QueryPch(istrStart) );
  50. }