Name

basic_fstream class template — Class template for file input and output streams

Synopsis

template <class charT, class traits=char_traits<charT> >
class basic_fstream : public basic_iostream<charT,traits>
{
public:
  typedef charT char_type;
  typedef typename traits::int_type int_type;
  typedef typename traits::pos_type pos_type;
  typedef typename traits::off_type off_type;
  typedef traits traits_type;
   
  basic_fstream(  );
  explicit basic_fstream(const char* filename,
                         ios_base::openmode mode = ios_base::in|ios_base::out);
   
  basic_filebuf<charT,traits>* rdbuf(  ) const;
  bool is_open(  );
  void open(const char* filename, 
            ios_base::openmode mode = ios_base::in|ios_base::out);
  void close(  );
};

The basic_fstream class template supports reading and writing to and from named files using a basic_filebuf<charT, traits> object. (See <istream> for a description of the base-class template, basic_iostream.) In the following member function descriptions, the file buffer object is assumed to be a private data member with the name buf.