BOOL CopyFile(lpszExistingFile, lpszNewFile, fFailIfExists) | |||||
LPTSTR lpszExistingFile; | /* name of an existing file | */ | |||
LPTSTR lpszNewFile; | /* name to copy to | */ | |||
BOOL fFailIfExists; | /* fail if new name already exists | */ |
The CopyFile function copies a file.
lpszExistingFile
Points to a null-terminated string specifying the name of an existing file.
lpszNewFile
Points to a null-terminated string specifying the name of the file to be copied to.
fFailIfExists
Specifies how this operation is to proceed if the specified new file already exists. If this parameter is TRUE, the function fails if lpszNewFile already exists. If this parameter is FALSE, the function succeeds even if lpszNewFile exists.
The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.
This function will not copy a file onto itself.
Security attributes for the existing file are not copied to the new file.
The CopyFile function may be used as either a wide-character function (where text arguments must use Unicode) or an ANSI function (where text arguments must use characters from the Windows 3.x character set installed).
MoveFile