展开全部
以下代码实现把d1.txt和d2.txt中的内容合并到d3.txt,d1的内容在前,d2在后: #include <fstream> using namespace std; int main() { char* f1 = "d1.txt"; char* f2 = "d2.txt"; char* f3 = "d3.txt"; ifstream inFile1( f1 ); ifstream inFile2( f2 ); ofstream outFile( f3 ); outFile << inFile1.rdbuf(); outFile << inFile2.rdbuf(); inFile1.close(); inFile2.close(); outFile.close(); } 不懂请追问,满意望采纳:)
展开全部
以下代码实现把d1.txt和d2.txt中的内容合并到d3.txt,d1的内容在前,d2在后:
#include
<fstream>
using
namespace
std;
int
main()
{
char*
f1
=
"d1.txt";
char*
f2
=
"d2.txt";
char*
f3
=
"d3.txt";
ifstream
inFile1(
f1
);
ifstream
inFile2(
f2
);
ofstream
outFile(
f3
);
outFile
<<
inFile1.rdbuf();
outFile
<<
inFile2.rdbuf();
inFile1.close();
inFile2.close();
outFile.close();
}
不懂请追问,满意望采纳:)
#include
<fstream>
using
namespace
std;
int
main()
{
char*
f1
=
"d1.txt";
char*
f2
=
"d2.txt";
char*
f3
=
"d3.txt";
ifstream
inFile1(
f1
);
ifstream
inFile2(
f2
);
ofstream
outFile(
f3
);
outFile
<<
inFile1.rdbuf();
outFile
<<
inFile2.rdbuf();
inFile1.close();
inFile2.close();
outFile.close();
}
不懂请追问,满意望采纳:)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询