資源簡(jiǎn)介
這個(gè)小程序通過(guò)C++二進(jìn)制流操作,簡(jiǎn)單的實(shí)現(xiàn)的文件復(fù)制,我測(cè)試過(guò)好幾路類(lèi)型的文件均順利通過(guò),詳細(xì)信息請(qǐng)看Readme.txt文檔。這個(gè)程序如此之短,又是免費(fèi)的,歡迎下載。有什么不周之處,還望認(rèn)真指正,必虛心受教。

代碼片段和文件信息
#include
void?main(void)
{
char?fname1[256]fname2[256];
char?buff[4096];
fstream?infileoutfile;
cout<<“Enter?the?source?file:??“;
cin.getline(fname1256);
infile.open(fname1ios::in|ios::binary|ios::nocreate);
if?(!infile)
{
cerr<<“Cannot?open?the?file:??“< return;
}
cout<<“Enter?the?destination?file:??“;
cin.getline(fname2256);
outfile.open(fname2ios::out|ios::binary|ios::noreplace);
if(!outfile)
{
cerr<<“Cannot?open?the?file:??“< return;
}
int?n;
while(!infile.eof())
{
infile.read(buff4096);
n=infile.gcount();
outfile.write(buffn);
}
infile.close();
outfile.close();
}
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????文件?????????698??2011-05-08?13:25??e.cpp
?????文件??????225327??2011-05-09?02:32??e.exe
?????文件?????????759??2011-05-09?02:56??Readme.txt
評(píng)論
共有 條評(píng)論