C++ Program to read the contents from a file


#include<iostream.h>
#include<fstream.h>
#include<conio.h>
void main()
{
clrscr();
char c[25];
ifstream ifs("h:\\first1.txt");
cout<<"\n\n\t\tFILE CONTENT\n\n";
while(!ifs.eof())
{
cout<<"\nPosition : "<<ifs.tellg();
ifs.getline(c,20);//READING FROM THE FILE
cout<<"\nPosition : "<<ifs.tellg()<<"\tcontent : ";
cout<<c<<endl;
}
getch();
}