Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!decwrl!ucbvax!van-bc!ubc-cs!alberta!herald.usask.ca!lowey From: lowey@herald.usask.ca (Kevin Lowey) Newsgroups: comp.lang.pascal Subject: Re: Blockread/write problem Message-ID: <1990Aug29.233532.19599@herald.usask.ca> Date: 29 Aug 90 23:35:32 GMT References: <1990Aug29.123053.17412@ux1.cso.uiuc.edu> Organization: University of Saskatchewan Lines: 51 From article <1990Aug29.123053.17412@ux1.cso.uiuc.edu>, by dslg0849@uxa.cso.uiuc.edu (Daniel S. Lewart): > S89405079%HSEPM1.HSE.NL@vm1.nodak.edu writes: > >>2. When I reset a read-only file, why does TurboPascal then say that it is >> impossible to open the file<> > > My guess is that this is an 'undocumented feature' (aka bug). This "bug" is "undocumented" on page 114 of the Turbo Pascal 5.0 Reference Guide under the "FILEMODE" variable: === Beginning of quote === The FILEMODE variable defined by the SYSTEM unit determines the access code to pass to DOS when typed and untyped files (not text files) are opened using the RESET procedure. The default FILEMODE is 2, which allows both reading and writing. Assigning another value to FILEMODE causes all subsequent RESETS to use that mode. The range of valid FILEMODE values depends on the version of DOS in use. However, for all versions, the following modes are defined: 0: READ ONLY 1: WRITE ONLY 2: READ/WRITE DOS version 3.x defines additional modes, which are primarily concerned with file-sharing on networks. (For further details on these, please refer to your DOS Programmer's reference manual.) NOTE: New files created using REWRITE are always opened in READ/WRITE mode, corresponding to FILEMODE = 2. === End of quote === Also, in the section on DOS file errors, on page 468: === Start of quote === 5 File Access Denied. - Reported by RESET or APPEND if FILEMODE allows writing and the name assigned to the file variable specifies a directory or a read-only file. === End of quote === Funny what you find when you look the error messages up in the manual #8-) - Kevin Lowey (LOWEY@SASK.USASK.CA LOWEY@SASK.BITNET)