home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_11_07 / 1107026a < prev    next >
Text File  |  1993-04-28  |  1KB  |  43 lines

  1. // File : mstream.h   
  2. // Header file for using the MDA output stream, mout.
  3.  
  4. #ifndef __MSTREAM_H
  5. #define __MSTREAM_H
  6.  
  7. #include <iostream.h>    // for ostream class
  8. #include <strstrea.h>    // for streambuf class
  9. #include <_defs.h>       // for _CLASSDEF and _CLASSTYPE
  10.  
  11. _CLASSDEF(mstreambuf)    // create typedefs for the class
  12. class _CLASSTYPE mstreambuf : public streambuf
  13. {
  14.     private:
  15.         static unsigned int far* screen;  // monochrome memory area pointer
  16.         static int column;                // current column position
  17.       static int row;                     // current row position
  18.         void newline();                   // generates a new line on monitor
  19.     public:
  20.         mstreambuf(char* s, int n);
  21.         ~mstreambuf();
  22.         virtual int sync();               // Empties the put area
  23.         virtual int overflow(int);        // Also empties the put area
  24. };
  25.  
  26. _CLASSDEF(mstream)       // create typedefs for the class
  27. class _CLASSTYPE mstream : public ostream
  28. {
  29.     private:
  30.         enum {bsize=128};                 // stream buffer size
  31.         char msgs[bsize];                 // stream buffer
  32.         Pmstreambuf strbuf;               // pointer to mstreambuf
  33.     public:
  34.         mstream();
  35.         ~mstream();
  36. };
  37.  
  38. extern mstream mout;                      // reference to global instance
  39.  
  40. #endif    // End of File : MSTREAM.H   
  41.  
  42.  
  43.