xHarbour Reference Documentation > Function Reference |
Deletes a file from disk.
FErase( <cFileName> ) --> nSuccess
The return value is 0 when the file is successfully deleted, or -1 on failure. Use function FError() to determine the cause of failure.
The low-level file function FErase() deletes a file from disk. The file must be closed before it can be deleted.
Note that <cFileName> must include the entire path and file name. If no path is specified, the function searches only the current directory to delete the file. The setting SET DEFAULT and SET PATH are ignored by FErase().
See also: | CLOSE, ERASE, FClose(), FCreate(), FError(), FOpen(), FRead(), FRename(), FSeek(), FWrite(), RENAME |
Category: | File functions , Low level file functions |
Source: | rtl\philes.c |
LIB: | xhb.lib |
DLL: | xhbdll.dll |
// The example deletes all CDX index files found in the current // directory. #include "Directry.ch" PROCEDURE Main LOCAL aCdxFiles := Directory( "*.CDX" ) AEval( aCdxFiles, { |aFile| FErase( aFile[ F_NAME ] ) } ) RETURN
http://www.xHarbour.com