home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!munnari.oz.au!metro!seagoon.newcastle.edu.au!cis1005.newcastle.edu.au!sbarr
- From: sbarr@nyx.cs.du.edu (Sam E. Barr)
- Subject: Re: Problems with IOResult (TP.6)
- Message-ID: <sbarr.1.714023372@nyx.cs.du.edu>
- Sender: news@seagoon.newcastle.edu.au
- Organization: Uni of Newcastle, Australia
- References: <h07mcp=.gabriel@netcom.com>
- Date: Mon, 17 Aug 1992 03:49:32 GMT
- Lines: 39
-
- In article <h07mcp=.gabriel@netcom.com> gabriel@netcom.com (Gabriel Beccar-Varela) writes:
-
- >I have problems with the IOResult function. It gives me a non-zero result
- >when I know positively that there is no I/O problem (I confirmed this by
- >running the same code with IOResult commented out). I suspect that my disk
- >cache is causing the problem. The IOResult function works if I do a dummy
- >call to it before calling it for real. Like this:
- >
- > error := IOResult;
- > {$I-}
- > rewrite(f);
- > {$I+}
- > if IOResult <> 0 then ...
- >
- >Any suggestions?
-
- The problem here is that TP store the IOResult variable until you read it,
- after which it clear it. So if you make a call to a function which returns
- a non-zero IOResult, and then call another i/o function without first
- reading, and thus clearing IOResult, you still get a non-zero result,
- regardless of the result of the second function.
-
- The other problem arrising from this is that you cannot use a call such as
-
- if IOResult <> 0 then
- if IOResult = 8 then ....
-
- because the IOResult is cleared after you read it the first time, and thus
- will be zero for the next read.
-
- I'll leave it up to you to decide whether this is a bug or a feature, but
- for my mind it is a pain in the neck either way!! :(
-
- >
- >Thank you.
- Your Welcome!
-
- Sam Barr
- sbarr@nyx.cs.du.edu
-