TURBO PASCAL |
Новости
|
34: Why can't I open read-only files? I get "File access denied".A: The answer is rather simple, but it is not well displayed in the manuals. In order to read a read-only file you have to set the FileMode as 0 like below. Else you'll get runtime error 005 "File access denied". var f : text; (* Can be any file type *) savefm : byte; begin savefm := FileMode; (* Save the current FileMode status *) FileMode := 0; (* The default is 2 *) assign (f, 'readonly.txt'); reset (f); { have your wicked ways } close (f); FileMode := savefm; (* Restore the original FileMode *) end.Contents |
(с)Все права защищены По всем интересующим вопросам прошу писать на электронный адрес |