Write a program to Copy one file into another file

/*
    Copy one file into another file
*/
#include<iostream>
#include<fstream>
using namespace std;

int main()
{
   /* char f[250];

    cout<<"\n\n Enter file to copy: ";
    cin>>f;
*/
    ifstream orig("ABC.txt",ios::in);
    ofstream cop("XYZ.txt",ios::out);

    char c;

    orig.get(c);
    while(!orig.eof())
    {
       cop<<c;
       orig.get(c);
    }
    orig.close();
    cop.close();
    cout<<"\n\n Copied Succeful";
    return 0;
}

Previous
Next Post »