c++文件拷贝问题
//程序实现功能:将D盘里的两个文件(1.txt和2.txt)中的内容复制到D盘里的a.txt文档中//问题:没有实现预订的功能,请问为什么?
#include <iostream>
#include <fstream>
using namespace std;
int main(void)
{ ofstream out;
ifstream in;
char ch;
out.open("D:\\a.txt",ios::app);
if (!out) { cout<<"out ERROR!"<<endl; }
in.open("D:\\1.txt",ios::in);
if (!in) { cout<<"1 ERROR!"<<endl; }
while( in.get(ch) ) { out<<ch; }
out<<ch;
in.close();
in.open("D:\\2.txt",ios::in);
if (!in) { cout<<"2 ERROR!"<<endl; }
while( in.get(ch) ) { out<<ch; }
out<<ch;
in.close();
out.close();
return 0;
}