Thursday, November 25, 2010

C++ FILE COPY

#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char source[100],target[100];
char ch;
cout<<"enter source filename\n";
cin>>source;
cout<<"enter target filename\n";
cin>>target;
ifstream infile(source);
ofstream outfile(target);
while(infile)
{
infile.get(ch);
outfile.put(ch);
}
infile.close();
outfile.close();
return 0;
}

No comments:

Post a Comment

FOLLOWERS