home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / strmbdbp.cpp < prev    next >
C/C++ Source or Header  |  1998-06-17  |  1KB  |  42 lines

  1. /***
  2. *strmbdbp.cpp - streambuf::dbp() debug routine
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       Dump debug info about streambuf to stdout.
  8. *
  9. *******************************************************************************/
  10.  
  11. #include <cruntime.h>
  12. #include <internal.h>
  13. #include <io.h>
  14. #include <stdio.h>
  15. #include <iostream.h>
  16. #pragma hdrstop
  17.  
  18. #pragma check_stack(on)         // large buffer(s)
  19.  
  20. void streambuf::dbp()
  21. {
  22. int olen;
  23. _WINSTATIC char obuffer[256];
  24.     if (unbuffered())
  25.         olen = sprintf(obuffer,
  26.             "\nSTREAMBUF DEBUG INFO: this=%p, unbuffered\n",
  27.             (void *) this);
  28.     else
  29.         {
  30.         olen = sprintf(obuffer,
  31.             "\nSTREAMBUF DEBUG INFO: this=%p, _fAlloc=%d\n"
  32.             "  base()=%p, ebuf()=%p,  blen()=%d\n"
  33.             " pbase()=%p, pptr()=%p, epptr()=%p\n"
  34.             " eback()=%p, gptr()=%p, egptr()=%p\n",
  35.             (void *) this, (_fAlloc),
  36.              base(), ebuf(),  blen(),
  37.             pbase(), pptr(), epptr(),
  38.             eback(), gptr(), egptr());
  39.         }
  40.     _write(1,obuffer,olen);     // direct write to stdout
  41. }
  42.