Freigeben über


ifstream

Defines a stream to be used to read single-byte character data serially from a file. ifstream is a typedef that specializes the template class 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 template class 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();

}

Requirements

Header: <fstream>

Namespace: std

See Also

Reference

basic_ifstream Class

iostream Programming

iostreams Conventions

Other Resources

basic_ifstream Members

<fstream> Members