help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions][Variables] Reference for unit 'sysutils' (#rtl)

DeleteFile

Delete a file from the filesystem.

Declaration

Source position: filutilh.inc line 94

function DeleteFile(

  const FileName: String

):Boolean;

Description

DeleteFile deletes file FileName from disk. The function returns True if the file was successfully removed, False otherwise.

Errors

On error, False is returned.

See also

FileCreate

  

Create a new file and return a handle to it.

FileExists

  

Check whether a file exists in the filesystem.

Example

Program Example31;

{ This program demonstrates the DeleteFile function }

Uses sysutils;

Var
  Line : String;
  F,I : Longint;

Begin
  F:=FileCreate('test.txt');
  Line:='Some string line.'#10;
  For I:=1 to 10 do
    FileWrite (F,Line[1],Length(Line));
  FileClose(F);
  DeleteFile('test.txt');
End.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505