/*MEGING OF TWO FILES INTO 3rd*/
#include
//#include
#include
#include
//using namespace std;
int main()
{
clrscr();
ifstream file1("demo.cpp");
if(file1.fail())
{
cout<<"Cannot open file1";
//getch();
//return;
}
char ch;
ofstream file3("123.cpp");
if(file3.fail())
{
cout<<"cannot open destination file";
//getch();
//return;
}
{
while(ch!=EOF)
{
ch=file1.get();
if(ch==EOF)
break;
//cout<
file3.put(ch);
}
//ch='a';
file1.close();
file3.close();
file3.open("123.cpp",ios::app);
ifstream file2("dat.cpp");
if(file2.fail())
{
cout<<"Cannot open file2";
// getch();
//return 0;
}
char ch1;
do
{
ch1=file2.get();
file3.put(ch1);
//cout<
}while(ch1!=EOF);
ch='a';
file2.close();
file3.close();
ifstream file("123.cpp");
cout<<"\n\n...........Content of file 3 ARE......................\n\n";
while(ch!=EOF)
{
ch=file.get();
cout<
}
}
cout<<"\n\n\n\t\tPRESS ANY KEY TO EXIT";
getch();
return 0;
}//end main()
Copyright © 2011 - All Rights Reserved - Softron.in
Template by Softron Technology