Deleting a File

From RAD Studio
Jump to: navigation, search

Go Up to Manipulating Files

Deleting a file erases the file from the disk and removes the entry from the disk's directory. There is no corresponding operation to restore a deleted file, so applications should generally allow users to confirm before deleting files.

To delete a file, pass the name of the file to the DeleteFile function:


To delete a file in C++Builder, use either the remove, wremove function in stdio.h or the DeleteFile function in winbase.h.

DeleteFile returns true if it deleted the file and false if it did not delete the file (because, for example, the file did not exist or was read-only). DeleteFile erases the file named by FileName from the disk.

See Also