xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

FErase()

Deletes a file from disk.

Syntax

FErase( <cFileName> ) --> nSuccess

Arguments

<cFilename>
This is a character string holding the name of the file to delete. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched and deleted in the current directory.

Return

The return value is 0 when the file is successfully deleted, or -1 on failure. Use function FError() to determine the cause of failure.

Description

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().

Info

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

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe