Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Exact Syntax for DeleteFile

Posted on 2001-08-23
5
Medium Priority
?
178 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 60 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

Independent Software Vendors: 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

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Loops Section Overview
Suggested Courses

610 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