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

  1. /*[]------------------------------------------------------------[]*/
  2. /*|                                                              |*/
  3. /*|     srbdalc.cpp                                              |*/
  4. /*|                                                              |*/
  5. /*|     Class strstreambuf                                       |*/
  6. /*|          int strstreambuf::doallocate()                      |*/
  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 <strstrea.h>
  20.  
  21. int strstreambuf::doallocate()
  22. {
  23.     int size = next_alloc ? next_alloc : MinStrstreamAlloc;
  24.     char *p;
  25.     if( allocf )
  26.         p = (char*)(*allocf)((long)size);
  27.     else
  28.         p = new char[size];
  29.     if( ! p )
  30.         return EOF;
  31.  
  32.     next_alloc = 0; // assume next_alloc increment is one time only
  33.     setb(p, p + size, 0);
  34.     *p = 0;
  35.     return 1;
  36. }
  37.  
  38.  
  39.