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.

72 lines
1.5 KiB

  1. /*****************************************************************/
  2. /** Microsoft Windows for Workgroups **/
  3. /** Copyright (C) Microsoft Corp., 1991-1992 **/
  4. /*****************************************************************/
  5. /*
  6. stratoi.cxx
  7. NLS/DBCS-aware string class: atoi method
  8. This file contains the implementation of the atoi 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. markbl 06/04/91 Created
  13. */
  14. #include "npcommon.h"
  15. extern "C"
  16. {
  17. #include <netlib.h>
  18. #include <stdlib.h>
  19. }
  20. #if defined(DEBUG)
  21. static const CHAR szFileName[] = __FILE__;
  22. #define _FILENAME_DEFINED_ONCE szFileName
  23. #endif
  24. #include <npassert.h>
  25. #include <npstring.h>
  26. /*******************************************************************
  27. NAME: NLS_STR::atoi
  28. SYNOPSIS: Returns *this in its integer numeric equivalent
  29. ENTRY: With no arguments, parses from beginning of string.
  30. Given an ISTR, starts at that point within the string.
  31. EXIT:
  32. NOTES: Uses C-Runtime atoi function
  33. HISTORY:
  34. markbl 06/04/91 Written
  35. beng 07/22/91 Callable on erroneous string; simplified CheckIstr
  36. ********************************************************************/
  37. INT NLS_STR::atoi() const
  38. {
  39. if (QueryError())
  40. return 0;
  41. return ::atoi( _pchData );
  42. }
  43. INT NLS_STR::atoi( const ISTR & istrStart ) const
  44. {
  45. if (QueryError())
  46. return 0;
  47. CheckIstr( istrStart );
  48. return ::atoi( QueryPch(istrStart) );
  49. }