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

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     stbdsgtn.cpp                                             |*/
  4. /*|                                                              |*/
  5. /*|     Class streambuf                                          |*/
  6. /*|          int streambuf::do_sgetn( 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. // called when sgetn finds not enough chars in the get area
  22.  
  23. int streambuf::do_sgetn(char* s, int n)
  24. {
  25.     int c, i;
  26.  
  27.     i = in_avail();
  28.     if( i > 0 )
  29.         {
  30.         memcpy(s, gptr_, i);
  31.         s += i;
  32.         gbump(i);
  33.         }
  34.     while( i < n  &&  (c = sbumpc()) != EOF )
  35.         {
  36.         *s++ = c;
  37.         ++i;
  38.         }
  39.     return i;
  40. }
  41.  
  42.  
  43.