home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!psinntp!newton.hartwick.edu!wisanr
- From: wisanr@newton.hartwick.edu
- Newsgroups: comp.lang.pascal
- Subject: TP's reset on read-only files
- Message-ID: <1992Dec12.214246.50@newton.hartwick.edu>
- Date: 12 Dec 92 21:42:46 -0500
- Organization: HARTWICK COLLEGE
- Lines: 27
-
-
- I've been astonished to discover that TP's reset procedure can't open a
- read-only file ex@|cept as a text file. This appears to be true of
- every version since TP1. If it weren't clearly documented I'd call it a bug:
- reset opens a text file for input and any other kind of file for
- input and output. In consequence, DOS will reject an attempt to reset a file
- with attribute read-only.
-
- The only work-around I've found is to change the attribute, open and
- read the file, close it, and put it back to read-only. I don't like it because
- a program that stops abnormally might close the file, but it
- will surely not restore the attribute.
- TP7 comes with the source code for the run-time library, and it's
- perfectly clear there in FCTL.ASM. TP opens the file with the standard
- file-handle DOS call: INT 21h with AH=3Ch and AL=2. AL=2 opens for both
- read and write access. AL=0 would open for read only and AL=1 for write
- only. The value for AL is taken from a typed constant in SYSTEM.PAS
-
- Ideally, I'd like to add a new procedure, say reset2read which would load AL=0
- in FCTL.ASM, but I'm diffident about tryingl that. The
- trouble is that you'd have to insert a new typed constant and a new procedure
- declaration in SYSTEM.PAS, and the lists of declarations there
- is peppered with warnings not to change anything because the compiler
- depends on their exact order.
-
- Now, what?
-
-