Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - del() delete a file from disk http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 del()               Delete a file from disk
------------------------------------------------------------------------------
 Declaration
   file.hdr

 Syntax
   func logical del extern
   param const char cFileName

 Arguments
   cFileName is the name of the file to delete.

 Return
   A logical indicating the success of operation.

 Description
   del() erases a file specified by cFileName, which may contain drive and
   path names as well, but no wild card characters like "*", or "?".

   del() is similar to the erase command, but its return value indicates if
   the file could be successfully deleted, and in case del() is called with a
   non-existing file name, no run-time error will occur.

   Make sure that files you want to delete are closed prior to calling del().

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   proc Test_del
   vardef
      char cFileName
   enddef
   cFileName := "\"                             // create in current directory
   if createtempfile( cFileName )               // create temporary file
      ? "Temporary file", cFileName, "created"
      if del( cFileName )                       // delete temporary file
         ? "Temporary file deleted"
      else
         ? "Could not delete file " + cFileName
      endif
   else
      ? "File creation failed"
   endif
   endproc

   proc main
   Test_del()
   endproc

See Also: erase exist()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson