home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!wupost!waikato.ac.nz!canterbury.ac.nz!cctr132
- Newsgroups: comp.lang.pascal
- Subject: Re: Problems with IOResult (TP.6)
- Message-ID: <1992Aug18.173012.394@csc.canterbury.ac.nz>
- From: cctr132@csc.canterbury.ac.nz (Nick FitzGerald, CSC, Uni. of Canterbury, NZ)
- Date: 18 Aug 92 17:30:11 +1200
- References: <h07mcp=.gabriel@netcom.com> <sbarr.1.714023372@nyx.cs.du.edu>
- Organization: University of Canterbury, Christchurch, New Zealand
- Lines: 42
-
- In article <sbarr.1.714023372@nyx.cs.du.edu>, sbarr@nyx.cs.du.edu
- (Sam E. Barr) writes:
-
- [original problem description from gabriel@netcom.com deleted]
- > 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.
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- Come on Sam - if we are going to help, let's at least get it right.
-
- I've never used TP 6, but for all versions from 3.01 to 5.5 inclusive,
- with I/O checking off, if a standard TP I/O function is about to be
- called and IOResult is non-zero (or, at least positive ?) that function
- is -skipped-. The compiler builds code with I/O checking on to generate
- a run-time error on an I/O error and with checking off to ensure that no
- further I/O is done (with possibly disastrous effects) until IOResult
- has been cleared (it is assumed that the programmer knows what s/he is
- doing and takes the appropriate action, given the reported error).
-
- > 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.
-
- This is -clearly- documented, and I would hope anyone contemplating
- writing their own I/O error handling read this and other relevant parts
- of the Manuals/References very carefully before embarking.
-
- > 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!! :(
-
- Given the above, you may now understand why this feature was designed
- thus. Why do you expect error-handling to be easy?
-
- +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
- Nick FitzGerald, PC Applications Consultant, CSC, Uni of Canterbury, N.Z.
- n.fitzgerald@csc.canterbury.ac.nz (64)(3) 364-2337 Voice, 364-2332 FAX
-