#include #include #define MAX_BUF 100 using namespace std; void copyfile(const char *file1, const char *file2) { FILE* f1 = fopen(file1, "rb"); FILE* f2 = fopen(file1, "wb"); if (f1 == NULL || f2 == NULL) return; char buf[MAX_BUF]; int count; do { count=fread(buf,1,MAX_BUF,f1); fwrite(buf, 1, MAX_BUF, f2); } while (count == MAX_BUF); fclose(f1); fclose(f2); } int main() { copyfile("C:\\Users\\pc\\Desktop\\in.txt","C:\\Users\\pc\\Desktop\\out.txt"); cout << "Succesfully" << endl; return 0; }