// // File : FdStdioStream.hh // // Purpose: Declaration of the class FdStdioStream // // $Id: FdStdioStream.hh 8758 2010-09-27 12:16:24Z mathes $ // /** @file FdStdioStream.hh * Declaration of the class FdStdioStream. * @author H.-J. Mathes, FzK */ #ifndef _FdUtil_FdStdioStream_hh_ #define _FdUtil_FdStdioStream_hh_ #include #ifdef __GNUC__ // class stdiostream is available for gcc 3.x # if __GNUC__ < 3 # include # else # include # include # endif // __GNUC__ < 3 #else # error This software was never compiled with compilers other than gcc ! #endif // __GNUC__ #ifndef NO_VERSION # include #endif // NO_VERSION namespace FdUtil { #ifdef __GNUC__ # if __GNUC__ < 3 typedef std::ostdiostream OstdioStream; # else // __GNUC__ >= 3 /** This class implements a backward compatible ostdiostream. * * The class ostdiostream was available in former implementations of the * GNU C++ library. ostdiostream is intended to be used as a ostream compatible * stream derived from a FILE* . */ class OstdioStream : public std::ostream { public: OstdioStream(FILE*f) : std::ostream( &fFilebuf ), fFilebuf(f, ios_base::out) {} private: OstdioStream(); __gnu_cxx::stdio_filebuf fFilebuf; }; # endif // __GNUC__ < 3 #endif // __GNUC__ } // namespace FdUtil #endif // _FdUtil_FdStdioStream_hh_