Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Clipper Tools One Guide - <b>deletefile()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DELETEFILE()

Syntax:     DELETEFILE(<expC>)

Arguments:  <expC> corresponds to the name of the file to erase.

Returns:    A numeric value.
            A code which indicates whether an error has occurred.

            Code        Definition
            ----        ----------
              0         No error arisen
             -2         File not found
             -3         Access path not found
             -5         Access refused (e.g., file is read only)

Usage:      Unlike FILEDELETE(), where it is possible to specify file
            groups with wildcards, DELETEFILE() will only accept a
            specific file name.  It is therefore only possible to erase one
            file using this function.  However, the function does avoid all
            DOS error messages, and returns an error code directly to
            the calling program.  Error-tolerant erasures in networks are
            possible using this function (see example).

Notes:      A drive designator and a path name are allowed
            but not wildcards.

Library:    CT1.LIB


--------------------------------- Example ------------------------------

Examples:   * How NOT to erase in a network environment.
            IF FILE("TEST.DBF")
               * Is it actually possible to erase the file?
               DELETE FILE TEST.DBF
            ENDIF

            * The correct way.
            status = DELETEFILE("TEST.DBF")
            IF status = 0
               ? "File erased."
            ELSE
               IF status = -5
                  ? "File used differently."
                  ? "Access refused."
               ENDIF
            ENDIF




See Also: FILEDELETE()

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