Ron
2007-01-06 23:24:51
Returns true if the file exists. :)
Function code:
Test Function Code:
~Ron
Function code:
// FileExists() will check if a file exists on your computer.
// Made by Ron. :)
function FileExists(Location: string): Boolean;
var
a: TStringList;
begin
try
a := TStringList.Create;
a.LoadFromFile(Location);
finally
a.free;
Result := True;
except
Result := False;
end;
end;
Test Function Code:
program New;
const
TheFile = 'c:\Windows\regedit.exe';
// FileExists() will check if a file exists on your computer.
// Made by Ron. :)
function FileExists(Location: string): Boolean;
var
a: TStringList;
begin
try
a := TStringList.Create;
a.LoadFromFile(Location);
finally
a.free;
Result := True;
except
Result := False;
end;
end;
begin
ClearDebug;
if(FileExists(TheFile))then
WriteLn(TheFile + ' exists!')
else
WriteLn(TheFile + ' does not exist!');
end.
~Ron