* In a message originally to Luke Webber
Hi Luke,
* In a msg originally to All, Luke Webber said:
LW > I posted an article yesterday about an EInOutError. "File
LW > access denied"
LW > exception on my first call to Rewrite. Turns out it was
LW > happening because
LW > I had some code in my form load event which was meant to
LW > create some
LW > directories if they didn't already exist.
LW > I've worked up a little sample, and I'm pretty {*word*76}y sure
LW > that this is
LW > an authentic bug. I'm not one to cry wolf, but it seems to
LW > me that an I/O
LW > error with {$I-} in effect will cause the next rewrite or
LW > reset to fail,
LW > UNLESS the IOResult function has been called in between. In
LW > my case, I
LW > didn't care if an error occurred, so I hadn't called
LW > IOResult.
LW > See the sample code below...
LW > procedure TForm1.BitBtn1Click(Sender: TObject);
LW > var
LW > MyFile : TextFile;
LW > IOR : integer;
LW > begin
LW > {$I-}
LW > MkDir('c:\windows');
LW > {$I+}
LW > if MessageDlg('Want to see an exception?',
LW > mtConfirmation,
LW > [mbYes, mbNo], 0) = mrNo then
LW > IOR := IOResult;
LW > AssignFile(MyFile, 'c:\autoexec.bat');
LW > Reset(MyFile);
LW > end;
LW > Looks like a bug to me, and it killed about six hours of my
LW > time all up,
LW > so I just wanted to make it known.
I met with pretty much the same problem myself a couple of weeks back and it
nearly drove me mad trying to find out what was wrong, especially since the
identical section of code worked perfectly okay when put into a blank project
for testing purposes but failed every time in the application I was writing.
Eventually by setting various "watches" and stepping through it I found that
IOResult was already had a value of 3 when going INTO my file Reset line and
that was causing the problem. Armed with that info I "fixed" it by adding an
extra line to read IOResult in order to re-zero it, unfortunately my hairline
still hasn't recovered from the tortuous ordeal.
Still looking on the bright side I suppose it's a lesson I'll never forget so
won't happen again {this side of senile dementia anyway}. <g>
You have my sympathy as a fellow sufferer.
Keith.
keith.ander...@astrot.dircon.co.uk
...Remote file XDPB structure firmware restriction