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

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     istgbuf.cpp                                              |*/
  4. /*|                                                              |*/
  5. /*|     Class istream                                            |*/
  6. /*|          istream& istream::get( streambuf&, char )           |*/
  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.  
  21. // extract characters into a streambuf up to delimiter
  22.  
  23. istream _FAR & istream::get(streambuf _FAR & s, char d)
  24. {
  25.     if( ipfx1() )
  26.         {
  27.         int c;
  28.         int err = 0;
  29.         while( (c = bp->sgetc()) != d  &&  c != EOF )
  30.             {
  31.             if( s.sputc(c) == EOF )
  32.                 {
  33.                 err = 1;
  34.                 break;
  35.                 }
  36.             ++gcount_;
  37.             bp->stossc();
  38.             }
  39.         if( c == EOF )
  40.             setstate(ios::eofbit);
  41.         if( err )
  42.             setstate(ios::failbit);
  43.         }
  44.     return *this;
  45. }
  46.  
  47.  
  48.