#include<iostream.h>
#include<fstream.h>
using namespace std;
int main()
{
ofstream file;
file.open("TEST.txt",ios::ate);
file<<"Suraj Kumar Jana\n";
file<<"\n\n";
file<<"I like Computer Science";
int p= file.tellp();//finding the size of a file
cout<<"Size of the file is :"<<p;
cout<<"\n\n\n\n";
file.close();
const int N=80;
char line[N];
ifstream inf;
inf.open("TEST.txt");
while(inf)
{
inf.getline(line,N);
cout<<line<<"\n";
}
inf.close();
return 0;
}
#include<fstream.h>
using namespace std;
int main()
{
ofstream file;
file.open("TEST.txt",ios::ate);
file<<"Suraj Kumar Jana\n";
file<<"\n\n";
file<<"I like Computer Science";
int p= file.tellp();//finding the size of a file
cout<<"Size of the file is :"<<p;
cout<<"\n\n\n\n";
file.close();
const int N=80;
char line[N];
ifstream inf;
inf.open("TEST.txt");
while(inf)
{
inf.getline(line,N);
cout<<line<<"\n";
}
inf.close();
return 0;
}
0 comments:
Post a Comment