home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c081_11 / 2.ddi / INCLUDE.ZIP / STDIOSTR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1991-02-13  |  1.6 KB  |  76 lines

  1. /* stdiostream.h -- class stdiobuf and stdiostream declarations
  2.  
  3.     Copyright (c) 1990,1991 by Borland International    
  4.     All rights reserved
  5.  
  6.     NOTE: These are inefficient and obsolete.  Use the standard classes and
  7.     functions in <fstream.h> instead.
  8. */
  9.  
  10. #ifndef __cplusplus
  11. #error Must use C++ for the type stdiostream.
  12. #endif
  13.  
  14. #ifndef __STDSTREAM_H
  15. #define __STDSTREAM_H
  16.  
  17. #if !defined( __IOSTREAM_H )
  18. #include <iostream.h>
  19. #endif
  20.  
  21. #if !defined( __STDIO_H )
  22. #include <stdio.h>
  23. #endif
  24.  
  25. #ifdef __DLL__
  26. #define _FAR far
  27. #else
  28. #define _FAR
  29. #endif
  30.  
  31. #if __STDC__
  32. #define _Cdecl
  33. #else
  34. #define _Cdecl  cdecl
  35. #endif
  36.  
  37. #if   defined(__SMALL__) || defined(__MEDIUM__)
  38. #define _CLASSTYPE  near
  39. #elif defined(__COMPACT__) || defined(__LARGE__)
  40. #define _CLASSTYPE  far
  41. #else
  42. #define _CLASSTYPE  huge
  43. #endif
  44.  
  45. class _CLASSTYPE stdiobuf : public streambuf {
  46. public:
  47.         _Cdecl stdiobuf(FILE _FAR *);
  48.     FILE _FAR * _Cdecl stdiofile();
  49.         _Cdecl ~stdiobuf();
  50.  
  51. virtual int _Cdecl overflow(int=EOF);
  52. virtual int _Cdecl pbackfail(int);
  53. virtual int _Cdecl sync();
  54. virtual streampos _Cdecl seekoff(streamoff, seek_dir, int);
  55. virtual int _Cdecl underflow();
  56.  
  57. private:
  58.     FILE _FAR * sio;            
  59.     char    lahead[2];
  60. };
  61. inline  FILE _FAR * _Cdecl stdiobuf::stdiofile() { return sio; }
  62.  
  63.  
  64. class _CLASSTYPE stdiostream : public ios {
  65. public:
  66.         _Cdecl stdiostream(FILE _FAR *);
  67.         _Cdecl ~stdiostream();
  68.     stdiobuf _FAR * _Cdecl rdbuf();
  69.  
  70. private:
  71.     stdiobuf buf;
  72. };
  73. inline  stdiobuf _FAR * _Cdecl stdiostream::rdbuf() { return &buf; }
  74.  
  75. #endif
  76.