The erase procedure


The erase procedure deletes a file.


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.


   // 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);
      fn : filename;
      f : binary;
      write('Which file do you want to delete? ');
      assign(f, fn);


Operating Systems: All
Standard Pascal: No