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

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     filename - istread.cpp                                   |*/
  4. /*|                                                              |*/
  5. /*|     Class istream                                            |*/
  6. /*|          istream& istream::read( signed char* , int )        |*/
  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. istream _FAR & istream::read(signed char* p, int len)
  22. {
  23.     if( ipfx1() )
  24.         {
  25.         int c = 0;
  26.         while( --len >= 0  &&  (c = bp->sgetc()) != EOF )
  27.             {
  28.             *p++ = c;
  29.             ++gcount_;
  30.             bp->stossc();
  31.             }
  32.         if( c == EOF )
  33.             setstate((len >= 0) ? (ios::eofbit | ios::failbit) : ios::eofbit);
  34.         }
  35.     return *this;
  36. }
  37.  
  38.  
  39.