libstdc++
|
Controlling input and output for files.
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
.
std::basic_fstream::basic_fstream | ( | ) | [inline] |
std::basic_fstream::basic_fstream | ( | const char * | __s, |
ios_base::openmode | __mode = ios_base::in | ios_base::out |
||
) | [inline, explicit] |
Create an input/output file stream.
s | Null terminated string specifying the filename. |
mode | Open file in specified mode (see std::ios_base). |
Tip: When using std::string to hold the filename, you must use .c_str() before passing it to this constructor.
Definition at line 801 of file fstream.
References open().
std::basic_fstream::basic_fstream | ( | const std::string & | __s, |
ios_base::openmode | __mode = ios_base::in | ios_base::out |
||
) | [inline, explicit] |
Create an input/output file stream.
s | Null terminated string specifying the filename. |
mode | Open file in specified mode (see std::ios_base). |
Definition at line 816 of file fstream.
References open().
std::basic_fstream::~basic_fstream | ( | ) | [inline] |
void std::basic_fstream::close | ( | ) | [inline] |
Close the file.
Calls std::basic_filebuf::close()
. If that function fails, failbit
is set in the stream's error state.
Definition at line 911 of file fstream.
References std::basic_filebuf::close(), and std::ios_base::failbit.
bool std::basic_fstream::is_open | ( | ) | [inline] |
Wrapper to test for an open file.
Definition at line 850 of file fstream.
References std::basic_filebuf::is_open().
void std::basic_fstream::open | ( | const char * | __s, |
ios_base::openmode | __mode = ios_base::in | ios_base::out |
||
) | [inline] |
Opens an external file.
s | The name of the file. |
mode | The open mode flags. |
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 871 of file fstream.
References std::basic_filebuf::open(), and std::ios_base::failbit.
Referenced by basic_fstream().
void std::basic_fstream::open | ( | const std::string & | __s, |
ios_base::openmode | __mode = ios_base::in | ios_base::out |
||
) | [inline] |
Opens an external file.
s | The name of the file. |
mode | The open mode flags. |
Calls std::basic_filebuf::open(s,mode)
. If that function fails, failbit
is set in the stream's error state.
Definition at line 892 of file fstream.
References std::basic_filebuf::open(), and std::ios_base::failbit.
__filebuf_type* std::basic_fstream::rdbuf | ( | ) | const [inline] |
Accessing the underlying buffer.
This hides both signatures of std::basic_ios::rdbuf().