Home
Forum: "Main";
Current archive: 2002.01.08;

Down

#### Question about the DeleteFile function Find similar branches

MARcoDEN   (2001-12-15 17:13) [0]

Probably everyone knows about the DeleteFile function. So, I have 2 questions: 1) the help says that if successful, the function returns a nonzero value. So why Delphi swears at this line:

if DeleteFile ("arj.exe") <> 0 then ShowMessage ("OK!") else Halt;

2) is also written in the help that to get detailed information call GetLastError. Tell me, please, using this function as an example.

Art   (2001-12-15 17:30) [1]

Have a message and everything, do you need it ??? or do it differently, first delete the file, and then look for it FileExists and display a message!

MARcoDEN   (2001-12-15 17:33) [2]

2Art: Tell me too ... I need to know exactly these things.

Art   (2001-12-15 17:40) [3]

Well, damn, then if DeleteFile ("arj.exe") = 0 then ShowMessage ("OK!") Else Halt;

evgeg   (2001-12-15 17:40) [4]

function DeleteFile (const FileName: string): Boolean;

Those. result type is boolean.

Art   (2001-12-15 17:40) [5]

Well, damn, then if DeleteFile ("arj.exe") = 0 then ShowMessage ("Error!") Else Halt;

Anatoly Podgoretsky   (2001-12-15 18:11) [6]

You are talking about different DeleteFile

Song   (2001-12-15 22:13) [7]

If DeleteFile prints Exception if the file does not have one, then you can:

try
DeleteFile ....
ShowMessage ...
except
Halt
end;

evgeg   (2001-12-16 00:30) [8]

> Anatoly Podgoretsky
I know, but he has a module connected with what I said.

> Art
Boolean can only be compared with true or false, but it does not need to be done,
since it can be directly used in the condition.
I wonder now you guess how to write a condition?

Anatoly Podgoretsky   (2001-12-16 11:05) [9]

The module is connected to it, I have no doubt, but throughout the discussion it is clear that we are talking about one thing, but trying to work with another

MARcoDEN   (2001-12-16 16:22) [10]

2Art: Have you ever tried to compile what you wrote in the program? Feels like no! Delphi gives the error: Incompatible types.
And no one really gave an answer to my question :(.

Anatoly Podgoretsky   (2001-12-16 17:37) [11]

You gave it to him several times and that is your problem, that you cannot understand.
Once again you speak about one DeleteFile from Windows, and you use DeleteFile from SysUtils.

Pages: 1 whole branch

Forum: "Main";
Current archive: 2002.01.08;