home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 9.ddi / IOSTRSR1.ZIP / ISTEATWH.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.3 KB  |  43 lines

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     isteatwh.cpp                                             |*/
  4. /*|                                                              |*/
  5. /*|     Class istream                                            |*/
  6. /*|          void istream::eatwhite()                            |*/
  7. /*|                                                              |*/
  8. /*[]------------------------------------------------------------[]*/
  9.  
  10. /*
  11.  *      C/C++ Run Time Library - Version 5.0
  12.  *
  13.  *      Copyright (c) 1990, 1992 by Borland International
  14.  *      All Rights Reserved.
  15.  *
  16.  */
  17.  
  18. #include <ioconfig.h>
  19. #include <iostream.h>
  20. #include <ctype.h>
  21.  
  22. // extract consecutive whitespace
  23.  
  24. //  NOTE: technically, eating whitespace shouldn't cause a failure,
  25. //  but because eatwhite() is only called in the context of another
  26. //  extractor, it's quicker to set failbit here rather than have
  27. //  every extractor set failbit if ipfx() fails.
  28.  
  29. void istream::eatwhite()
  30. {
  31.     int c;
  32.     while( (c = bp->sgetc()), isspace(c) )
  33.         {
  34.         bp->stossc();
  35.         ++gcount_;
  36.         }
  37.  
  38.     if( c == EOF )
  39.         setstate(ios::eofbit|ios::failbit);
  40. }
  41.  
  42.  
  43.