问题
填空题
有以下程序:
#include <iostream.h>
#include <fstream.h>
#include <stdlib.h>
int main()
fstream filel,file2;
char line[100];
filel.open("source.txt",ios::in);
if(!file1)
cout<<"Can’t open file source.txt!"<<end1;
abort();
file2.open("dest.txt",ios::out);
if(!file2)
cout<<"Can’t open file dest.txt!"<<end1;
abort();
while(!file1.eof())
filel.getline(1ine,100);
file2<<line;
file2<<end1;
filel.close();
file2.close();
return 0;
此程序实现的功能是 【15】 。
答案
参考答案:将文本文件source.txt中内容复制到文本文件dest.txt中
解析: 程序首先将两个文件source和dest都打开,然后通过while循环,以一行为单位进行内容的复制。