1. Computing & Technology
Glossary|Tips/Tricks|FREE App/VCL|Best'O'Net|Books|Link Back

Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
 

Erase

unit
System
category
text file routines

declaration
procedure Erase(var F)

description
Deletes a file.

Erase accepts any file-type variable F as its parameter. The F is assigned with AssignFile. The F must be closed with CloseFile before erasing. If F exists and is closed it gets deleted, otherwise an EInOutError exception occurs.

example
var F : file;

if OpenDialog1.Execute then do begin
  AsignFile(F, OpenDialog1.FileName);
  Erase(F);
end;

in real code
File IO in Delphi
Working with disk files with Delphi's Pascal. Find out about handling text (ASCII) files, typed files and untyped files.
Deleting group of files
The code example demonstrates using the SHFileOperation function to copy a group of files and display a progress dialog. You can also use the following flags to delete, move and rename a group of files.

see also
DeleteFile


 Free Delphi code snippet inside every Delphi Newsletter!
Subscribe to the Newsletter
Name
Email

 Got some code to share? Got a question? Need some help?

Discuss in my forum

©2012 About.com. All rights reserved.

A part of The New York Times Company.