Re: Can't understand why these exceptions occur...
- From: Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx>
- Date: Sat, 31 May 2008 15:40:42 -0400
Ikke wrote:
Jamie <jamie_ka1lpa_not_valid_after_ka1lpa_@xxxxxxxxxxx> wrote in
news:sbh0k.36$sf2.8@xxxxxxxxxxxx:
<snip>
because you close a file that does not exist!
I'm afraid I have to disagree with you Jamie. From LoadCache:
---
if FileExists(cacheName) then
begin
AssignFile(cache, cacheName);
Reset(cache);
idx := 1;
while Not(eof(cache)) and (idx < Length(files)) do
begin
Read(cache, files[idx]);
Inc(idx);
end;
CloseFile(cache);
end;
---
The file will only be closed if it exists. If it doesn't, it's never assigned nor closed. Now, from SaveCache:
---
AssignFile(cache, cacheName);
ReWrite(cache);
idx := 1;
while (idx < Length(files)) do
begin
if (files[idx].name <> '') then
begin
Write(cache, files[idx]);
end;
Inc(idx);
end;
CloseFile(cache);
---
Here, I rewrite the file, so it does exist at the time I close it.
So as you can see, there should be no problem with/when closing the file IMHO.
Thanks,
Ikke
Please Disable the io trap {$I-}
and use the IOResult after each Read/write
function... to test...
also...
If IoResult is not 0 , forwarding Pascal IO
functions will fail!
I use InOUtRes := 0 when I know the error has
been handled if I don't want to use the IoResult
using the IoResult clears the error after it returns
the current error value.
the InOutRes is the variable that holds it.
On entry, you should always do
InOutRes := 0;
to make sure you don't have any errors from some where else
lingering.
http://webpages.charter.net/jamie_5"
.
- Follow-Ups:
- References:
- Can't understand why these exceptions occur...
- From: Ikke
- Re: Can't understand why these exceptions occur...
- From: Skybuck Flying
- Re: Can't understand why these exceptions occur...
- From: Jamie
- Re: Can't understand why these exceptions occur...
- From: Ikke
- Re: Can't understand why these exceptions occur...
- From: Jamie
- Re: Can't understand why these exceptions occur...
- From: Ikke
- Can't understand why these exceptions occur...
- Prev by Date: Re: Can't understand why these exceptions occur...
- Next by Date: Re: Can't understand why these exceptions occur...
- Previous by thread: Re: Can't understand why these exceptions occur...
- Next by thread: Re: Can't understand why these exceptions occur...
- Index(es):
Relevant Pages
|