std::basic_fstream< _CharT, _Traits >
Controlling input and output for files.
- Provided by: libstdc++-7-doc (Version: 7.5.0-6ubuntu2)
- Source: gcc-7
- Report a bug
Controlling input and output for files.
Inherits std::basic_iostream< _CharT, _Traits >.
typedef basic_filebuf< char_type, traits_type >
__filebuf_type
typedef basic_ios< char_type, traits_type > __ios_type
typedef basic_iostream< char_type, traits_type >
__iostream_type
typedef basic_istream< _CharT, _Traits > __istream_type
typedef basic_ostream< _CharT, _Traits > __ostream_type
typedef _CharT char_type
typedef traits_type::int_type int_type
typedef traits_type::off_type off_type
typedef traits_type::pos_type pos_type
typedef _Traits traits_type
basic_fstream ()
Default constructor. basic_fstream (basic_fstream
&&__rhs)
basic_fstream (const basic_fstream &)=delete
basic_fstream (const char *__s, ios_base::openmode
__mode=ios_base::in|ios_base::out)
Create an input/output file stream. basic_fstream (const
std::string &__s, ios_base::openmode
__mode=ios_base::in|ios_base::out)
Create an input/output file stream. ~basic_fstream ()
The destructor does nothing. void close ()
Close the file. bool is_open ()
Wrapper to test for an open file. bool is_open () const
void open (const char *__s, ios_base::openmode
__mode=ios_base::in|ios_base::out)
Opens an external file. void open (const std::string &__s,
ios_base::openmode __mode=ios_base::in|ios_base::out)
Opens an external file. basic_fstream & operator=
(basic_fstream &&__rhs)
basic_fstream & operator= (const basic_fstream
&)=delete
__filebuf_type * rdbuf () const
Accessing the underlying buffer. void swap (basic_fstream
&__rhs)
void swap (basic_iostream &__rhs)
class std::basic_fstream< _CharT, _Traits >" Controlling input and output for files.
Template Parameters
This class supports reading from and writing to named files, using the inherited functions from std::basic_iostream. To control the associated sequence, an instance of std::basic_filebuf is used, which this page refers to as sb.
Definition at line 862 of file fstream.
Default constructor. Initializes sb using its default constructor, and passes &sb to the base class initializer. Does not open any files (you haven't given it a filename to open).
Definition at line 889 of file fstream.
Create an input/output file stream.
Parameters
Tip: When using std::string to hold the filename, you must use .c_str() before passing it to this constructor.
Definition at line 902 of file fstream.
Create an input/output file stream.
Parameters
Definition at line 917 of file fstream.
The destructor does nothing. The file is closed by the filebuf object, not the formatting stream.
Definition at line 939 of file fstream.
Close the file. Calls std::basic_filebuf::close(). If that function fails, failbit is set in the stream's error state.
Definition at line 1041 of file fstream.
Wrapper to test for an open file.
Returns
Definition at line 980 of file fstream.
Opens an external file.
Parameters
Calls std::basic_filebuf::open(__s,__mode). If that function fails, failbit is set in the stream's error state.
Tip: When using std::string to hold the filename, you must use .c_str() before passing it to this constructor.
Definition at line 1001 of file fstream.
Opens an external file.
Parameters
Calls std::basic_filebuf::open(__s,__mode). If that function fails, failbit is set in the stream's error state.
Definition at line 1022 of file fstream.
Accessing the underlying buffer.
Returns
This hides both signatures of std::basic_ios::rdbuf().
Definition at line 972 of file fstream.
Generated automatically by Doxygen for libstdc++ from the source code.