Teuchos - Trilinos Tools Package  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_FILEstream.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_FILESTREAM_H
11 #define TEUCHOS_FILESTREAM_H
12 
14 
15 #include <streambuf>
16 
17 namespace Teuchos
18 {
19 
21 
35  class FILEstream : public std::streambuf {
36 
37  public:
38 
40 
44  FILEstream(std::FILE* file): self_file(file) {}
45 
46  protected:
47 
48  std::streambuf::int_type overflow(std::streambuf::int_type c) {
49  return std::fputc(c, self_file) == EOF?
50  std::streambuf::traits_type::eof(): c;
51  }
52 
53  FILE* self_file;
54  };
55 }
56 
57 #endif
FILEstream(std::FILE *file)
Constructor.
Teuchos::FILEstream: Combined C FILE and C++ stream.