Monday, July 16, 2007

C++ Copy File Function

CopyFile Function

This function is used to copy a file from a path to another file location/path.

The structure of the function as follow::

BOOL WINAPI CopyFile(
IN LPCSTR lpExistingFileName,
IN LPCSTR lpNewFileName,
IN BOOL bFailIfExists
);

Where::
lpExistingFileName is the source file location
lpNewFileName is the location where the file copy to
bFailIfExists is to set to replace or not.

bFailIfExists == true
The file won't be replaced.
bFailIfExists == false
The file will be replaced.