Listing 3 (vstream.cpp) Video Stream Package

#include <iostream.h>
#include <conio.h>


class Conbuf : public streambuf
      {
      int do_sputn(const char *s,int n);
      int overflow(int=EOF);
      } conbuf;

int Conbuf::overflow(int c)
      {
      do_sputn((char *)&c,1);
      return 1;
      }

int Conbuf::do_sputn(const char *s,int n)
      {
      int n1=n;
      while (n1--)
             {
             putch(*s);
             if (*s++=='\n')
                     {
                     putch('\r');
                     clreol();
                     }
             }
      return n;
      }

ostream conout=&conbuf;

// End of File