Show: Object Pascal C++
Display Preferences

Copying a File

From Appmethod Topics
Jump to: navigation, search

Go Up to Manipulating Files

The RTL does not provide any routines for copying a file. However, if you are writing Windows-only applications, you can directly call the Windows API CopyFile Function to copy a file, or the Indy CopyFileTo function if you are using Indy/InternetDirect.

Like most of the run-time library file routines, CopyFile takes a filename as a parameter, not a file handle. When copying a file, be aware that the file attributes for the existing file are copied to the new file, but the security attributes are not. CopyFile is also useful when moving files across drives because neither the RenameFile function nor the Windows API MoveFile function can rename or move files across drives.

See Also

Personal tools
In other languages