Solved

Exact Syntax for DeleteFile

Posted on 2001-08-23
5
173 Views
Last Modified: 2010-05-18
OK i want to delete

C:\abc.dat

i know not much but slowly learning, so i want exact code
including sys uses var
the lot, just as if you were deleting the abc.dat file yourself
thanks in advance
0
Comment
Question by:neopolis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
ITugay earned 15 total points
ID: 6417015
Hi neopolis,


program DeleteSample;

uses
  SysUtils;

const
  FileName = 'C:\abc.dat';

begin
  FileSetAttr(FileName, 0);  // file may be read-only, reset attributes to
  DeleteFile(FileName); // and delete it
end.
0
 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 6417017
Why would you delete a file if you have created it first with FileClose(FileCreate('C:\WinNt\System32\MyDll.Dll'));

Got it ?

The Mayor ;-)



0
 

Author Comment

by:neopolis
ID: 6417059
I will try this, yes i am deleting the same file as i created, because when the file is varified then the software keeps running but when the file is deleted then the file cannot be varified so the software stops and closes this is how i protect my trial demo mode software
*smiles* i use another programming language and am new at delphi... but am learning good thanks to all the experts here... i will be back to see if i made the delete code work...
0
 

Author Comment

by:neopolis
ID: 6417078
Cool bananas works....Thanks
0
 
LVL 6

Expert Comment

by:wimmeyvaert
ID: 6417137
What I mean is, that I put a comment on a previous question you put on EE, which I suppose is correct.

Maybe you can, at least, leave a comment or accept my comment as an answer before asking new questions on EE.

Best regards,
The Mayor.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question