//文件複製操作.cpp
#include<iostream.h>
#include<fstream.h> //有關文件輸入、輸出的定義文件
#include<stdlib.h>
void main()
{
char ch;
fstream inf,outf;
inf.open("d://temp//filein.txt",ios::in);
if(!inf){
cout<<"It cannot open the file!"<<endl;
abort();
}
outf.open("d://temp//fileout.txt",ios::out);
if(!outf){
cout<<"It cannot open the file!"<<endl;
abort();
}
while(!inf.eof()&&inf.get(ch)){
//inf.get(ch);//按字符讀取文件filein.dat的數據
outf.put(ch);
}// 將數據按字符寫入文件fileout.dat中
inf.close();
outf.close();
}