Image

Programs - C++ - File Handling

Program:


#include<fstream.h>
#include<conio.h>
void main()
{
  ifstream fin;
  fin.open("emp.cpp");
  ofstream fout;
  fout.open("newemp.cpp");
char name[20];
int age;
float bs;
  clrscr();
while(!fin.eof())
  {
  fin>>name>>age>>bs;
  fout<<name<<age<<bs;
  }
cout<<"file copied";
  fin.close();
  fout.close();
  getch();
 }