home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / stdiostr.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  2KB  |  95 lines

  1. /***
  2. *stdiostr.h - definitions/declarations for stdiobuf, stdiostream
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       This file defines the classes, values, macros, and functions
  8. *       used by the stdiostream and stdiobuf classes.
  9. *       [AT&T C++]
  10. *
  11. *       [Public]
  12. *
  13. ****/
  14.  
  15. #if     _MSC_VER > 1000
  16. #pragma once
  17. #endif
  18.  
  19. #ifdef  __cplusplus
  20.  
  21. #ifndef _INC_STDIOSTREAM
  22. #define _INC_STDIOSTREAM
  23.  
  24. #if     !defined(_WIN32) && !defined(_MAC)
  25. #error ERROR: Only Mac or Win32 targets supported!
  26. #endif
  27.  
  28.  
  29. #ifdef  _MSC_VER
  30. // Currently, all MS C compilers for Win32 platforms default to 8 byte
  31. // alignment.
  32. #pragma pack(push,8)
  33.  
  34. #include <useoldio.h>
  35.  
  36. #endif  // _MSC_VER
  37.  
  38. /* Define _CRTIMP */
  39.  
  40. #ifndef _CRTIMP
  41. /* current definition */
  42. #ifdef  _DLL
  43. #define _CRTIMP __declspec(dllimport)
  44. #else   /* ndef _DLL */
  45. #define _CRTIMP
  46. #endif  /* _DLL */
  47. #endif  /* _CRTIMP */
  48.  
  49.  
  50. #include <iostream.h>
  51. #include <stdio.h>
  52.  
  53. #ifdef  _MSC_VER
  54. #pragma warning(disable:4514)           // disable unwanted /W4 warning
  55. // #pragma warning(default:4514)        // use this to reenable, if necessary
  56. #endif  // _MSC_VER
  57.  
  58. class _CRTIMP stdiobuf : public streambuf  {
  59. public:
  60.         stdiobuf(FILE* f);
  61. FILE *  stdiofile() { return _str; }
  62.  
  63. virtual int pbackfail(int c);
  64. virtual int overflow(int c = EOF);
  65. virtual int underflow();
  66. virtual streampos seekoff( streamoff, ios::seek_dir, int =ios::in|ios::out);
  67. virtual int sync();
  68.         ~stdiobuf();
  69.         int setrwbuf(int _rsize, int _wsize);
  70. // protected:
  71. // virtual int doallocate();
  72. private:
  73.         FILE * _str;
  74. };
  75.  
  76. // obsolescent
  77. class _CRTIMP stdiostream : public iostream {  // note: spec.'d as : public IOS...
  78. public:
  79.         stdiostream(FILE *);
  80.         ~stdiostream();
  81.         stdiobuf* rdbuf() const { return (stdiobuf*) ostream::rdbuf(); }
  82.         
  83. private:
  84. };
  85.  
  86. #ifdef  _MSC_VER
  87. // Restore default packing
  88. #pragma pack(pop)
  89. #endif  // _MSC_VER
  90.  
  91. #endif  // _INC_STDIOSTREAM
  92.  
  93. #endif  /* __cplusplus */
  94.  
  95.