home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / CIncludes / stdiostr.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-28  |  712 b   |  42 lines  |  [TEXT/MPS ]

  1. #ifndef __STDIOSTR_H
  2. #define __STDIOSTR_H
  3.  
  4. #include <stdio.h>
  5. #include <iostream.h>
  6.  
  7. class stdiobuf : public streambuf {
  8. public:
  9.     stdiobuf(FILE*);
  10.     FILE* stdiofile() { return fp; }
  11.     ~stdiobuf();
  12.  
  13.     int  underflow();
  14. #if __ZTC__ > 0x214
  15.     int  overflow(int=EOF);
  16. #else
  17.     int overflow(int);
  18. #endif
  19.     int  pbackfail(int);
  20.  
  21. private:
  22.     FILE*   fp;
  23.     char *gptr_;
  24.     char *egptr_;
  25.                 // Save old gptr() & egptr() while using the
  26.                 // pushback buffer.
  27.     char pushback_buf[4];
  28.     int fillbuf();
  29. };
  30.  
  31. class stdiostream : public ios {
  32. public:
  33.     stdiostream(FILE*);
  34.     ~stdiostream();
  35.     stdiobuf* rdbuf() { return &buffer; }
  36.  
  37. private:
  38.     stdiobuf buffer;
  39. };
  40.  
  41. #endif
  42.