Skip to main content

Copy File in C++

 


#include<bits/stdc++.h>
#include<Windows.h>
using namespace std;

int main()
{
    BOOL cfile;
    cfile = CopyFileA("D:\\Text\\C++\\a.txt","D:\\Text\\C++\\new.txt",TRUE);
    if(cfile == FALSE){
        cout<<"Error!"<<GetLastError()<<endl;
    }
    else{
        cout<<"Successfully copied"<<endl;
    }
    system("PAUSE");
    return 0;
}

Comments