home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 7.ddi / MWHC.007 / N < prev    next >
Encoding:
Text File  |  1992-08-26  |  1.5 KB  |  69 lines

  1. /*
  2.  *   stdiostr.h
  3.  *
  4.  *   C++ IOStreams specialized for use in conjunction with
  5.  *   stdio FILEs.
  6.  *
  7.  *           Copyright (c) 1991-1992, MetaWare Incorporated
  8.  */
  9.  
  10. /*   $Id: stdiostr.h,v 1.6 1992/02/18 01:38:16 tom Exp $ */
  11.  
  12. #ifndef __STDIOSTREAM_H
  13. #define __STDIOSTREAM_H
  14. #pragma push_align_members(64);
  15.  
  16. #c_include <iostream.h>
  17. #c_include <stdio.h>
  18.  
  19.  
  20. #pragma on(nodebug)
  21.  
  22. /*
  23.  *  Class stdiobuf is provided to support concurrent use of the C stdio
  24.  *  and C++ iostreams standard input and output streams.  Using stdiobufs
  25.  *  can cause a severe degradation in performance.  It should not be
  26.  *  necessary to use stdiobufs if the standard output streams are set for
  27.  *  unit buffering (ios::unitbuf) and all input operations on cin are
  28.  *  line-oriented on a cooked input stream.
  29.  *
  30.  *  Use of class stdiobuf should be avoided whenever possible.
  31.  */
  32.  
  33. class stdiobuf : public streambuf {
  34.  
  35. private:
  36.     FILE*        _fp;            
  37.     char        _tmp_buf[2];
  38.  
  39. public:
  40.     virtual int    overflow(int=EOF);
  41.     virtual int    underflow();
  42.     virtual int    sync();
  43.     virtual streampos
  44.             seekoff(streamoff,ios::seek_dir,long);
  45.     virtual int    pbackfail(int __c);
  46.  
  47.             stdiobuf(FILE* __fp);
  48.     FILE*        stdiofile() { return _fp; }
  49.     virtual        ~stdiobuf();
  50.     };
  51.  
  52. class stdiostream : public ios {
  53. private:
  54.     stdiobuf    _buf;
  55.  
  56. public:
  57.             stdiostream(FILE* __fp);
  58.             ~stdiostream();
  59.     stdiobuf*    rdbuf() { return &_buf; }
  60.     };
  61.  
  62. #pragma pop(nodebug)
  63.  
  64.  
  65. #pragma pop_align_members();
  66. #endif __STDIOSTREAM_H
  67.  
  68. /**          Copyright (c) 1991-1992, MetaWare Incorporated             **/
  69.