BOOL CopyFile (
LPCTSTR lpexistingfilename,//pointer to name of a existing file
LPCTSTR lpnewfilename,//pointer to filename to copy to
BOOL bfailifexists//Flag for operation if file exists
);
The meaning of each of these parameters:
LPCTSTR Lpexistingfilename,//You want to copy the source file name
LPCTSTR Lpnewfilename,//You want to copy the target file name
BOOL bfailifexists///If Target already exists, does not copy (True) and returns false, overriding Target (false)
CopyFile
Copy files A through B, and if b already exists, overwrite
CopyFile (A, B, FALSE);
BOOL bcopy = false;
bcopy = CopyFile ("D:\\dtest16\\annet1"). DCM_0001.DCM "," D:\\DTEST16\\FILETEST\\001.DCM ", FALSE);
cout<<bcopy<<endl;
MoveFile//Move A to B MoveFile (a,b);
MoveFile ("D:\\DTEST16\\FILETEST\\MYFILE\\001.DCM", "D:\\DTEST16\\FILETEST\\MYFILE\\001\\001.DCM");
Expansion 1. The following encapsulates 4 functions _copyfile,_deletefile,_movefile,_renamefile
2. Each function copies the original path, ensuring that the path ends with 2 \0\0. (If you don't end with 2 \0\0, you tend to get an error)
3. Applies to files or folders