Have you looked into

[pascal]
{$I-}
OpenFile
{$I+}
If IOResult <> 0 then
Begin
End;
[/pascal]

Not sur eif its what you want - but it may be.