home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / _iostrea.cpp < prev    next >
C/C++ Source or Header  |  1998-06-17  |  2KB  |  75 lines

  1. /***
  2. * iostream.cpp - definitions for iostream classes
  3. *
  4. *       Copyright (c) 1991-1997, Microsoft Corporation.  All rights reserved.
  5. *
  6. *Purpose:
  7. *       Contains the member function definitions for iostream classes.  Also,
  8. *       precompile all header files used by iostream lib into iostream.pch.
  9. *
  10. *******************************************************************************/
  11.  
  12. // NOTE: the follow must include ALL header files used by any of the iostream
  13. //       source files which we want built into iostream.pch.  It is necessary
  14. //       to have the pch associated with exactly one of the library modules
  15. //       for efficient storage of Codeview info.
  16.  
  17. #include <cruntime.h>
  18. #include <internal.h>
  19. #include <limits.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <stdio.h>
  23. #include <errno.h>
  24. #include <ctype.h>
  25. #include <share.h>
  26. #include <fcntl.h>
  27. #include <io.h>
  28. #include <ios.h>
  29. #include <sys\types.h>
  30. #include <float.h>
  31. #include <iostream.h>
  32. #include <fstream.h>
  33. #include <strstrea.h>
  34. #include <stdiostr.h>
  35. #include <dbgint.h>
  36.  
  37. #pragma hdrstop                 // end of headers to precompile
  38.  
  39. #if defined (_MT) && defined (_DEBUG)
  40. // Critical section size should never change, but just to be safe...
  41. #include <windows.h>
  42. #endif  /* defined (_MT) && defined (_DEBUG) */
  43.  
  44.         iostream::iostream()
  45. : istream(), ostream()
  46. {
  47. #ifdef _MT
  48.         _ASSERTE(sizeof(_CRT_CRITICAL_SECTION) == sizeof(RTL_CRITICAL_SECTION));
  49. #endif  /* _MT */
  50. }
  51.  
  52.         iostream::iostream(streambuf * _sb)
  53. : istream(_sb), ostream(_sb)
  54. {
  55. #ifdef _MT
  56.         _ASSERTE(sizeof(_CRT_CRITICAL_SECTION) == sizeof(RTL_CRITICAL_SECTION));
  57. #endif  /* _MT */
  58. }
  59.  
  60.         iostream::iostream(const iostream& _strm)
  61. : istream(_strm), ostream(_strm)
  62. {
  63. #ifdef _MT
  64.         _ASSERTE(sizeof(_CRT_CRITICAL_SECTION) == sizeof(RTL_CRITICAL_SECTION));
  65. #endif  /* _MT */
  66. }
  67.  
  68. iostream::~iostream()
  69. {
  70. // if both input and output share the same streambuf, but not the same ios,
  71. // make sure only deleted once
  72. if ((istream::bp==ostream::bp) && (&istream::bp!=&ostream::bp))
  73.         istream::bp = NULL;     // let ostream::ios::~ios() do it
  74. }
  75.