The Delphi Bug List

Entry No.
212
RTL - Sys - System
The Reset procedure fails on files that are Read-only. This is easily worked around by adding the statement FileMode := 0 just before calling Reset.
1.02 2.01 3.0 3.01 3.02 4.0 4.01 4.02 4.03 5.0 5.01 6.0 6.01 6.02 Kylix 1.0
GotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotchaGotcha
Description
Reported by Reinier Sterkenburg
The Reset procedure fails on files that are Read-only. This is easily worked around by adding the statement FileMode := 0 just before calling Reset.
User-contributed comments
Anonymous
20 Mar 2001  06:40 PM GMT
This is not a bug.

If FileMode <> 0, then the developer tells the RTL to open a file with *WRITE* access. That of course will fail for a read-only file.
Reinier Sterkenburg
27 Mar 2001  07:01 PM GMT
Mr. A. has a point here.
I (admitting to be both submitter and checker of this report) have always assumed that Reset was used exclusively for read access. Which is 'more or less' true for text files but not for random access files.
I was going to bring up that the developer does not 'tell the RTL' anything (not explicitly) about how to open the file and that the RTL should assume 'read only' when Reset is used. But this is not correct.

Jordan, I think the status should be changed into 'Gotcha' (still assuming that it is not uncommon to think that Reset is generally used for read-only access) because this behaviour is not too well documented. If my assumption is not correct (majority vote) or when a remark about the file mode is added in the Help for Reset, the item can be dropped.
Jordan Russell
01 Apr 2001  06:55 AM GMT
I agree. I'll update it now.
Charles Seitz
24 May 2005  10:15 PM GMT
This drove me crazy.

My app worked just fine until I tried to run it from a CD where all of the files it uses are ReadOnly.

--- CHAS
Latest update of this entry: 2001-06-10

Post a comment on this bug


Index page
Delphi Bug List home page
The Delphi Bug Lists are presently maintained by Jordan Russell, who has taken over this task from Reinier Sterkenburg since August 2000.
All feedback is appreciated. See also the feedback section of the Delphi Bug List home page.