Be Inquisitive ! Be Curious !! Explore !!! Enjoy !!!!

Today Program in C++:

| Friday, November 25


C++ Program for READING CONTENT FROM THE 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();
}

0 comments:

Post a Comment