Is there any function / procedure in Pascal program that can help me to check whether a file is present or not?
I hate the 'File not found' run-time error and just want to use the program to tell me the file is not present and then I can continue to
run the program without being thrown out.
Comments
:
: I hate the 'File not found' run-time error and just want to use the program to tell me the file is not present and then I can continue to
: run the program without being thrown out.
:
You can use the $I compiler directive in combination with IOResult() for that. See the help file on IOResult of an example.
: :
: : I hate the 'File not found' run-time error and just want to use the program to tell me the file is not present and then I can continue to
: : run the program without being thrown out.
: :
: You can use the $I compiler directive in combination with IOResult() for that. See the help file on IOResult of an example.
:
[code]
function fileexists(s:string):boolean;
var
stream:file of byte;
begin
assign(stream,s);
{$I-}
reset(stream);
{$I+}
close(stream);
fileexists:=true;
if ioresult<>0 then fileexists:=false;
end;
[/code]
****************
[b][blue]GAASHIUS[/blue][/b]