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

  1. /***
  2. * istrdbl.cpp - definition for operator>>(double) member funct for istream class
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       Definition of operator>>(double) member function for istream class.
  8. *       [AT&T C++]
  9. *
  10. *******************************************************************************/
  11.  
  12. #include <cruntime.h>
  13. #include <internal.h>
  14. #include <stdlib.h>
  15. #include <iostream.h>
  16. #pragma hdrstop
  17.  
  18. #pragma check_stack(on)         // large buffer(s)
  19.  
  20. #define MAXDBLSIZ       28
  21.  
  22. istream& istream::operator>>(double& n)
  23. {
  24. _WINSTATIC char ibuffer[MAXDBLSIZ];
  25.     char ** endptr = (char**)NULL;
  26.     if (ipfx(0))
  27.         {
  28.         if (getdouble(ibuffer, MAXDBLSIZ)>0)
  29.             {
  30.             n = strtod(ibuffer, endptr);
  31.             }
  32.         isfx();
  33.         }
  34. return *this;
  35. }
  36.