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
Solved

Exact Syntax for DeleteFile

Posted on 2001-08-23
5
172 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
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Correct Component for Shopping Cart. 2 112
Convert GUI app into console app for Win32 Env 5 109
Dynamically Created Query 3 62
Delphi Seattle StructureView color 1 14
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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

789 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