Description
The erase procedure deletes a file.
Parameter
The erase procedure's only parameter is a reference to a file variable. This file variable must be named (see the built-in procedure assign), and can not be open.
Example
//*************************************************
// This program removes (i.e. erases) a file
// First it asks for the name of the file
// Then it assigns the name to a file variable
// Finally it calls 'erase' on the file variable
//************************************************
program rm(input, output);
var
fn : filename;
f : binary;
begin
write('Which file do you want to delete? ');
readln(fn);
assign(f, fn);
erase(f);
end.
Portability
Operating Systems: All
Standard Pascal: No