文本文件的拷贝-文件操作2

文本文件的拷贝-文件操作2

描述

编写程序,完成文本文件的拷贝

输入

要拷贝的文件名以及拷贝之后的文件名

输出

拷贝之后的文件内容

样例输入

d:\a.txt (要保证指定位置上有该文件)
d:\la.txt

样例输出

文件内容

代码

#include 
#include 
#include 
using namespace std;
const int N = 110;
int main()
{
	string temp;
	ofstream outfile("d:\la.txt");
	ifstream infile("d:\a.txt");
	while(!infile.eof())
	{
		getline(infile,temp,'\n');
		outfile << temp << endl;
	}
	infile.close();
	outfile.close();
	return 0;
} 

你可能感兴趣的:(文本文件的拷贝-文件操作2)