# include <iostream>
# include <fstream> # include <cstdlib> using namespace std; int main() { char ch; ifstream sfile("d:\\1.txt"); ofstream dfile("d:\\2.txt"); if(!sfile) { cout<<"不能打开源文件:"<<"d:\\1.txt"<<endl; return -1; } if(!dfile) { cout<<"不能打开目标文件夹:"<<"d:\\2.txt"<<endl; return -1; } sfile.unsetf(ios::skipws); while(sfile>>ch) dfile<<ch; sfile.close(); dfile.close(); return 0; |
|
来自: Frank_Chia > 《.NET》