Re: Can't understand why these exceptions occur...



Ikke wrote:


If I add InOutRes := 0 in any of the procedures, I get an error stating that InOutRes is not a variable.

Thanks,

Ikke

What compiler are you using?
I Hope not .NET!

also,
You didn't read carefully as to what I said about
IoResult.
It clears the state after each read.
this means.
If you do this
If Ioresult <> 0 THen WriteLn(IoResult), it'll always
be 0~! becayse the IoResult is a function and clears the internal
state before returning and returns what the state was..
If you access it again, like in your writeln, it will also be
0 because it's been cleared.!
you do this.
If IoResult <> 0 Then WriteLn('something wrong at Line what ever');
because after this, IoResult access will = 0 until the next failed
Pascal IO function.
It's a one shot deal!

If you don't have InOutRes to directly set it at the start.
then try this.
IoResult;
if its a proper function, it should just simply execute and just
through away the return value as it clears the internal value.
Make sure you enable your "extended syntax" option in the compiler.
if you have it. That'll let you call functions as procedures that
ignore the return value and not complain about it not being assigned to
something .
Like a VOID function in C/C++

If you want display the actual error code, in combination of how you
did it..
do this
Var
Inoutres:integer;

some where in code after a check should be performed.
InOutres := ioResult;

if InoutRes <> 0 then Writeln(InoutRes);

etc..
Or Do this , write a log Error Log Function...
Procedure IoErrorLog(Var LineNUmber:Integer);
Var
InoutRes:Integer;
begin
InoutRes := IoResult;
If INoutRes <> 0 then
WriteLn('IO error at Line #:',LineNumber');
End;

then you simple do this in your code

IoErrorLog(LineNumber?);

etc..
Just remember , your Pascal file code will not function correctly
if there is a lingering error.


http://webpages.charter.net/jamie_5";

.



Relevant Pages

  • Re: IO 32 and 103 error
    ... Cause the IOResult only contains the result of the last ... you mention old term like 'PASCAL file system' and I/O.. ... > and clear the internal IO error value which is InOutRes ... > set it to a non zero state.. ...
    (alt.comp.lang.borland-delphi)
  • Re: Delphi 2 Issue... need help...
    ... MyResult could return a 103 error consistently... ... Have you checked IOResult immediately after your last file operation? ... InOutRes and then setting it to zero. ... BUT if you are getting an Error 103, this indicates that a CloseFile, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Cant understand why these exceptions occur...
    ... If Ioresult 0 THen WriteLn, ... If INoutRes 0 then ... procedure LoadCache(Const cacheName: String); ... while Not) and (idx < Length(files)) do ...
    (alt.comp.lang.borland-delphi)
  • Re: IO 32 and 103 error
    ... to turn off pascal file functions I/O checking ... need to use the IoResult variable to check the ... and clear the internal IO error value which is InOutRes ... > * logFile and logFileName is set correctly in the constructor. ...
    (alt.comp.lang.borland-delphi)