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

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     ostibuf.cpp                                              |*/
  4. /*|                                                              |*/
  5. /*|     Class ostream                                            |*/
  6. /*|          ostream& ostream::operator<< ( streambuf * )        |*/
  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 from streambuf, insert into this ostream
  22. ostream _FAR & ostream::operator<< (streambuf* s)
  23. {
  24.     if( opfx() )
  25.         {
  26.         int c;
  27.         while( (c = s->sbumpc()) != EOF )
  28.             {
  29.             if( bp->sputc(c) == EOF )
  30.                 {
  31.                 setstate(ios::badbit);
  32.                 break;
  33.                 }
  34.             }
  35.         }
  36.     osfx();
  37.     return *this;
  38. }
  39.