Inheritance diagram for std::basic_fstream< _CharT, _Traits >:

Public Types | |
| typedef _CharT | char_type |
| typedef _Traits | traits_type |
| typedef traits_type::int_type | int_type |
| typedef traits_type::pos_type | pos_type |
| typedef traits_type::off_type | off_type |
| 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 |
Public Member Functions | |
| basic_fstream () | |
| Default constructor. | |
| basic_fstream (const char *__s, ios_base::openmode __mode=ios_base::in|ios_base::out) | |
| Create an input/output file stream. | |
| ~basic_fstream () | |
| The destructor does nothing. | |
| __filebuf_type * | rdbuf () const |
| Accessing the underlying buffer. | |
| 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 | close () |
| Close the file. | |
Private Attributes | |
| __filebuf_type | _M_filebuf |
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 661 of file fstream.
| typedef basic_filebuf<char_type, traits_type> std::basic_fstream< _CharT, _Traits >::__filebuf_type |
| typedef basic_ios<char_type, traits_type> std::basic_fstream< _CharT, _Traits >::__ios_type |
| typedef basic_iostream<char_type, traits_type> std::basic_fstream< _CharT, _Traits >::__iostream_type |
| typedef _CharT std::basic_fstream< _CharT, _Traits >::char_type |
These are standard types. They permit a standardized way of referring to names of (or names dependant on) the template parameters, which are specific to the implementation.
Reimplemented from std::basic_iostream< _CharT, _Traits >.
| typedef traits_type::int_type std::basic_fstream< _CharT, _Traits >::int_type |
| typedef traits_type::off_type std::basic_fstream< _CharT, _Traits >::off_type |
| typedef traits_type::pos_type std::basic_fstream< _CharT, _Traits >::pos_type |
| typedef _Traits std::basic_fstream< _CharT, _Traits >::traits_type |
| std::basic_fstream< _CharT, _Traits >::basic_fstream | ( | ) | [inline] |
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 688 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf, and std::basic_ios< _CharT, _Traits >::init().
| std::basic_fstream< _CharT, _Traits >::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). |
Definition at line 701 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf, std::basic_ios< _CharT, _Traits >::init(), and std::basic_fstream< _CharT, _Traits >::open().
| std::basic_fstream< _CharT, _Traits >::~basic_fstream | ( | ) | [inline] |
| void std::basic_fstream< _CharT, _Traits >::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 773 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf, std::basic_filebuf< _CharT, _Traits >::close(), and std::ios_base::failbit.
| bool std::basic_fstream< _CharT, _Traits >::is_open | ( | ) | const [inline] |
Definition at line 740 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf, and std::basic_filebuf< _CharT, _Traits >::is_open().
| bool std::basic_fstream< _CharT, _Traits >::is_open | ( | ) | [inline] |
Wrapper to test for an open file.
Definition at line 734 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf, and std::basic_filebuf< _CharT, _Traits >::is_open().
| void std::basic_fstream< _CharT, _Traits >::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. |
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 755 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf, std::basic_ios< _CharT, _Traits >::clear(), std::ios_base::failbit, and std::basic_filebuf< _CharT, _Traits >::open().
Referenced by std::basic_fstream< _CharT, _Traits >::basic_fstream().
| __filebuf_type* std::basic_fstream< _CharT, _Traits >::rdbuf | ( | ) | const [inline] |
Accessing the underlying buffer.
Reimplemented from std::basic_ios< _CharT, _Traits >.
Definition at line 726 of file fstream.
References std::basic_fstream< _CharT, _Traits >::_M_filebuf.
__filebuf_type std::basic_fstream< _CharT, _Traits >::_M_filebuf [private] |
Definition at line 677 of file fstream.
Referenced by std::basic_fstream< _CharT, _Traits >::basic_fstream(), std::basic_fstream< _CharT, _Traits >::close(), std::basic_fstream< _CharT, _Traits >::is_open(), std::basic_fstream< _CharT, _Traits >::open(), and std::basic_fstream< _CharT, _Traits >::rdbuf().
1.4.7