Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Erase Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
file_variable Typed, untyped, or text file; already assigned
Description
The Erase procedure removes an existing file of any type from a
disk directory. A prior call to Assign must associate file_variable
with an existing external file. Erase works the same as the DOS
command DEL or its synonym ERASE.
The file should be closed. Although Erase succeeds if the file is
open, it does not close the file. Erasing open files leaves lost
clusters on the disk. Also, the DOS file handle is not released
and remains unavailable for the rest of the program.
If no file exists with the name assigned to file_variable, an I/O
error occurs.
To prevent a program from halting with a run-time error when an I/O
error occurs, turn off I/O checking with {$I-} and check the return
value of the IOResult function.