//
// io.cpp
// firstcpp
//
// Created by 陈许兵 on 16/4/9.
// Copyright © 2016年 陈许兵. All rights reserved.
//
#include <iostream>
#include <fstream>
using namespace std;
bool copy(const char * src, const char * dest){
cout<< src << "," << dest << endl;
ifstream in;
ofstream out;
in.open(src,ios::binary);
if(in.fail()){
cout << "open " << src << " failed!!" << endl;
in.close();
out.close();
return false;
}
out.open(dest,ios::binary);
if(out.fail()){
cout << "open " << dest << " failed!!" << endl;
out.close();
in.close();
return false;
}
out << in.rdbuf();
out.close();
in.close();
return true;
}
int main(){
cout<<"hello"<<endl;
copy("/Users/chenxubing/books/C和指针.pdf","/Users/chenxubing/books/C和指针.copy.pdf");
return 0;
}
拷贝文件
最新推荐文章于 2023-04-23 17:32:50 发布