[fpc-pascal]SysUtils.FileExists bug under Go32v2

Anton Tichawa anton.tichawa at chello.at
Thu Feb 13 01:55:39 CET 2003


Hello!

The following should work under 32-bit windows-compatible os's:

***
Function FileExists (Const filename :String) :Boolean;
var
  S: TSEARCHREC;
begin
  R := FindFirst(Filename, faAnyFile, S);
  Result := R = 0;
  if R = 0 then FindClose(S);  
end;
***

Status: Untested.

Caution: The circumstances under which FindClose should be called are not 
clearly formulated by the original manufacturer. My procedure is just a 
proposal. I saw a system hanging several seconds or maybe even crashing when 
I called, or missed to call, FindClose. The fact that the condition R = 0 has 
to be tested twice, shows the poor quality of the API.

BTW: How and where can I obtain the original microsoft 32-bit windows API 
help files, and what names do they have? I thing *.chm or so?

HTH

Anton Tichawa.

----------

"Adas Methode war, wie sich zeigen wird, Tagträume in offenbar korrekte 
Berechnungen einzuweben."

Doris Langley Moore: Ada, Countess of Lovelace (London 1977).

----------

Anton Tichawa
Volkertstrasse 19 / 20
A-1020 Wien
mobil: +43 664 52 07 907
email: anton.tichawa at chello.at

----------



More information about the fpc-pascal mailing list