home *** CD-ROM | disk | FTP | other *** search
- Listing 1
-
- // CSTREAM.H
-
- #ifndef _CSTREAM_H
- #define _CSTREAM_H
-
- #include <iostream.h>
- #include <conio.h>
-
- class ConioBuffer: public streambuf {
- public:
- ConioBuffer () { unbuffered(1); }
- virtual ~ConioBuffer () {}
- virtual int overflow (int ch) {
- if(ch=='\n')
- { clreol(); putch('\r'); }
- putch(ch);
- if(ch=='\n')
- clreol();
- return ch;
- }
- };
-
- class ConioStream : public ostream {
- ConioBuffer *buf;
- public:
- ConioStream() : ostream() { buf=new ConioBuffer(); ios::init(buf); }
- virtual ~ConleStream () { if(buf) delete buf; }
- } ;
-
- #endif //_CSTREAM_H
-
-
-