แก้ไข

แชร์ผ่าน


<fstream> typedefs

filebuf
fstream
ifstream
ofstream
wfilebuf
wfstream
wifstream
wofstream

filebuf

A type basic_filebuf specialized on char template parameters.

typedef basic_filebuf<char, char_traits<char>> filebuf;

Remarks

The type is a synonym for class template basic_filebuf, specialized for elements of type char with default character traits.

fstream

A type basic_fstream specialized on char template parameters.

typedef basic_fstream<char, char_traits<char>> fstream;

Remarks

The type is a synonym for class template basic_fstream, specialized for elements of type char with default character traits.

ifstream

Defines a stream to be used to read single-byte character data serially from a file. ifstream is a typedef that specializes the class template basic_ifstream for char.

There is also wifstream, a typedef that specializes basic_ifstream to read wchar_t double-wide characters. For more information, see wifstream.

typedef basic_ifstream<char, char_traits<char>> ifstream;

Remarks

The type is a synonym for class template basic_ifstream, specialized for elements of type char with default character traits. An example is

using namespace std;

ifstream infile("existingtextfile.txt");

if (!infile.bad())
{
    // Dump the contents of the file to cout.
    cout << infile.rdbuf();infile.close();
}

ofstream

A type basic_ofstream specialized on char template parameters.

typedef basic_ofstream<char, char_traits<char>> ofstream;

Remarks

The type is a synonym for class template basic_ofstream, specialized for elements of type char with default character traits.

wfstream

A type basic_fstream specialized on wchar_t template parameters.

typedef basic_fstream<wchar_t, char_traits<wchar_t>> wfstream;

Remarks

The type is a synonym for class template basic_fstream, specialized for elements of type wchar_t with default character traits.

wifstream

A type basic_ifstream specialized on wchar_t template parameters.

typedef basic_ifstream<wchar_t, char_traits<wchar_t>> wifstream;

Remarks

The type is a synonym for class template basic_ifstream, specialized for elements of type wchar_t with default character traits.

wofstream

A type basic_ofstream specialized on wchar_t template parameters.

typedef basic_ofstream<wchar_t, char_traits<wchar_t>> wofstream;

Remarks

The type is a synonym for class template basic_ofstream, specialized for elements of type wchar_t with default character traits.

wfilebuf

A type basic_filebuf specialized on wchar_t template parameters.

typedef basic_filebuf<wchar_t, char_traits<wchar_t>> wfilebuf;

Remarks

The type is a synonym for class template basic_filebuf, specialized for elements of type wchar_t with default character traits.

See also

<fstream>