Reading from a File using ifstream class

This video tutorial explains how to read from a file using an ifstream class object.
You are gonna learn how to create an object of ifstream class, how to open a file for reading, how to associate a file with an object of ifstream class, how to read from the file using getline function in detail with example.

source code for this tutorial

#include <iostream>
#include <fstream>
using namespace std;

int main()
ifstream file;"anil.txt");
    cout << "error while opening the file";

cout << "reading from the file contents are"<<endl;
string line;
cout << line <<endl;

    return 0;