ifstream
Definisce un flusso da usare per leggere i dati di tipo carattere a un byte in sequenza da un file. ifstream è un typedef che specializza la classe modello basic_ifstream per char.
Esiste anche wifstream, un typedef che specializza basic_ifstream per leggere i caratteri wchar_t a larghezza doppia. Per altre informazioni, vedere wifstream.
typedef basic_ifstream<char, char_traits<char> > ifstream;
Note
Il tipo è un sinonimo della classe modello basic_ifstream specializzata per gli elementi di tipo char con tratti di carattere predefiniti. Di seguito è riportato un esempio:
using namespace std;
ifstream infile("existingtextfile.txt");
if (!infile.bad())
{
// Dump the contents of the file to cout.
cout << infile.rdbuf();
infile.close();
}
Requisiti
Intestazione: <fstream>
Spazio dei nomi: std