home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / stdiostr.h < prev    next >
C/C++ Source or Header  |  1998-06-17  |  3KB  |  117 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  /* _MSC_VER > 1000 */
  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  /* !defined (_WIN32) && !defined (_MAC) */
  27.  
  28. #ifndef _CRTBLD
  29. /* This version of the header files is NOT for user programs.
  30.  * It is intended for use when building the C runtimes ONLY.
  31.  * The version intended for public use will not have this message.
  32.  */
  33. #error ERROR: Use of C runtime library internal header file.
  34. #endif  /* _CRTBLD */
  35.  
  36. #ifdef _MSC_VER
  37. // Currently, all MS C compilers for Win32 platforms default to 8 byte
  38. // alignment.
  39. #pragma pack(push,8)
  40.  
  41. #include <useoldio.h>
  42.  
  43. #endif  /* _MSC_VER */
  44.  
  45. /* Define _CRTIMP */
  46.  
  47. #ifndef _CRTIMP
  48. /* current definition */
  49. #ifdef CRTDLL
  50. #define _CRTIMP __declspec(dllexport)
  51. #else  /* CRTDLL */
  52. #ifdef _DLL
  53. #define _CRTIMP __declspec(dllimport)
  54. #else  /* _DLL */
  55. #define _CRTIMP
  56. #endif  /* _DLL */
  57. #endif  /* CRTDLL */
  58. #endif  /* _CRTIMP */
  59.  
  60. #ifndef _INTERNAL_IFSTRIP_
  61. /* Define _CRTIMP1 */
  62.  
  63. #ifndef _CRTIMP1
  64. #ifdef CRTDLL1
  65. #define _CRTIMP1 __declspec(dllexport)
  66. #else  /* CRTDLL1 */
  67. #define _CRTIMP1 _CRTIMP
  68. #endif  /* CRTDLL1 */
  69. #endif  /* _CRTIMP1 */
  70. #endif  /* _INTERNAL_IFSTRIP_ */
  71.  
  72. #include <iostream.h>
  73. #include <stdio.h>
  74.  
  75. #ifdef _MSC_VER
  76. #pragma warning(disable:4514)           // disable unwanted /W4 warning
  77. // #pragma warning(default:4514)        // use this to reenable, if necessary
  78. #endif  /* _MSC_VER */
  79.  
  80. class _CRTIMP1 stdiobuf : public streambuf  {
  81. public:
  82.         stdiobuf(FILE* f);
  83. FILE *  stdiofile() { return _str; }
  84.  
  85. virtual int pbackfail(int c);
  86. virtual int overflow(int c = EOF);
  87. virtual int underflow();
  88. virtual streampos seekoff( streamoff, ios::seek_dir, int =ios::in|ios::out);
  89. virtual int sync();
  90.         ~stdiobuf();
  91.         int setrwbuf(int _rsize, int _wsize);
  92. // protected:
  93. // virtual int doallocate();
  94. private:
  95.         FILE * _str;
  96. };
  97.  
  98. // obsolescent
  99. class _CRTIMP1 stdiostream : public iostream {  // note: spec.'d as : public IOS...
  100. public:
  101.         stdiostream(FILE *);
  102.         ~stdiostream();
  103.         stdiobuf* rdbuf() const { return (stdiobuf*) ostream::rdbuf(); }
  104.  
  105. private:
  106. };
  107.  
  108. #ifdef _MSC_VER
  109. // Restore default packing
  110. #pragma pack(pop)
  111. #endif  /* _MSC_VER */
  112.  
  113. #endif  /* _INC_STDIOSTREAM */
  114.  
  115. #endif  /* __cplusplus */
  116.  
  117.