63,606
社区成员




//7-7.txt已存在,内容为ok
//可是程序执行后7-8内容为0x0012ff40,显然是个地址值啊。
#include <iostream.h>
#include <fstream.h>
//using namespace std;
int main()
{
ifstream ifile("7-7.txt");
if(! ifile){
cerr << "can not open 7-7.txt" << ifile << endl;
return -1;
}
ofstream ofile("7-8.txt");
if(! ofile){
cerr << "error" << ofile << endl;
}
ofile << ifile;
//while(ifile.get() && ofile) ofile << ifile;
ofile.close();
ofile.close();
return 0;
}
int main()
{
ifstream ifile("7-7.txt");
if(! ifile){
cerr << "can not open 7-7.txt" << ifile << endl;
return -1;
}
ofstream ofile("7-8.txt");
if(! ofile){
cerr << "error" << ofile << endl;
}
ofile << ifile.rdbuf();
ifile.close();
ofile.close();
return 0;
}