[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 DELETEFILE()
 Deletes an error-tolerant file
------------------------------------------------------------------------------
 Syntax

     DELETEFILE(<cFileName>) --> nErrorCode

 Argument

     <cFileName>  Designates which file name to delete.

 Returns

     DELETEFILE() returns a code that signifies its completion status:

     Table 7-1:  DELETEFILE() Error Codes
     ------------------------------------------------------------------------
     Code    Symb. constants     Definition
     ------------------------------------------------------------------------
      0      NO_DISK_ERR         No error occurs
     -2      ER_FILE_NOT_FOUND   File not found
     -3      ER_PATH_NOT_FOUND   Path not found
     -5      ER_ACCESS_DENIED    Access denied (e.g., file is read-only)
     ------------------------------------------------------------------------

 Description

     In contrast to FILEDELETE(), which permits you to specify file groups
     with wildcards, DELETEFILE() only accepts specific file names.  However,
     the function avoids all DOS error messages and returns an error code
     directly to the calling program.  This makes error-tolerant erasures in
     networks possible (see Examples).

 Note

     .  You can use a drive designator and path name, but no
        wildcards.

 Examples

     .  How NOT to delete a file in a network environment:

        IF FILE ("TEST.DBF")
           * Is it actually possible to delete the file?
           DELETE FILE TEST.DBF
        ENDIF

     .  This is a better way:

        nStatus  :=  DELETEFILE("TEST.DBF")
        IF nStatus == 0
           ? "File deleted."
        ELSE
           IF nStatus == -5
              ? "ACCESS DENIED!"
              ? "File in use elsewhere!"
           ENDIF
        ENDIF


See Also: FILEDELETE() RENAMEFILE()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson