int CopyFile (char sourceFileName[], char targetFileName[]);
Copies the contents of an existing file or group of files to another file or group of files.
If the target file is a directory, CopyFile copies the existing file or group of files into the directory.
![]() |
Note Windows SDK also contains a CopyFile function. If you include windows.h and do not include utility.h, you will receive compile errors if you call the CopyFile function. |
| Input | ||
| Name | Type | Description |
| sourceFileName | string | The pathname of the existing file to copy. sourceFileName can contain the wildcard characters '?' and '*,' in which case CopyFile copies all matching files. If you specify an empty string "", CopyFile copies the file found by the most recent call to GetFirstFile or GetNextFile. |
| targetFileName | string | The pathname of the target file. targetFileName can contain wildcard characters "?" and "*," in which case CopyFile matches this parameter to sourceFileName. If the target file is a directory, CopyFile copies the existing file or group of files into the directory. |
| Name | Type | Description | ||||||||||||||||||
| result | integer | The result of the call.
|