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

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