home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!haven.umd.edu!mimsy!nmrdc1!frmug!lill!vanney.raphael
- From: vanney.raphael@lill.frmug.fr.mugnet.org (Vanney Raphael)
- Newsgroups: comp.lang.pascal
- Subject: RE: TURBO PASCAL FUNC. ER
- Message-ID: <965.6.uupcb@lill.frmug.fr.mugnet.org>
- Date: 20 Dec 92 19:13:00 GMT
- Reply-To: vanney.raphael@lill.frmug.fr.mugnet.org (Vanney Raphael)
- Organization: Li'LL BBS - Paris, France
- Lines: 93
-
-
- -=> Quoting Thomas Rose to All <=-
-
- TR> From: toddy@uni-paderborn.de (Thomas Rose)
- TR> Newsgroups: comp.lang.pascal
- TR> Subject: Turbo Pascal Func. Erease
- TR> Date: 2 Dec 92 15:59:32 GMT
- TR> Organization: Uni-GH Paderborn, Germany
-
- TR> Hi, I have a problem with Turbo-Pascal 6.0 and the Procedure
- Erase(f).
- TR> The following little program shoud demontrate it:
-
- TR> program test;
-
- TR> uses dos;
-
- TR> var f : file;
- TR> err : word;
- TR> Begin
- TR> assign(f,'test.dat');
- TR> erase(f);
-
- TR> err := ioresult;
-
- TR> repeat until keypressed;
- TR> erase(f);
- TR> err := ioresult;
- TR> end.
-
- TR> When you test it with a write-protected disk, then you'll get first
- TR> the errornumber 150:'Disk is write-protected', but when you try it
- TR> once again, then the next errornumber is 2:'File not found'.
-
- TR> I need this Function for a program which deletes all files on a
- disk.
- TR> But when the disk is write-protected and i ask the User to remove
- it,
- TR> i have to try it once again. But then, the file will not be found.
-
- Huh ? Seems like your disk cache has got a problem handling this : I
- never
- encountered such a problem ;-)
-
- TR> Then another problem: is it possible to open a file, which has the
- TR> attributes 'read-only' ?? I tryed it with :
- TR> program test;
- TR> var f : file;
- TR> begin
- TR> assign(f,'io.sys');
- TR> reset(f);
- TR> writeln(ioresult:3);
- TR> end.
-
- TR> but i got the errornumber 5:'access denied'
-
- Hi !
- I have no satisfying answer to your first question, but here is how to
- open a file with R/O, Hiden and/or System attributes :
-
- Uses DOS ;
- Var f : Text ;
- Begin
- Assign(f, 'IO.SYS') ;
- SetFAttr(f, 0) ; { Don't expect this to work with
- directories
- nor volume id }
- { Here, take a look at DOSError }
- ReSet(f) ;
- { Check IOResult }
- .
- .
- .
- Close(f) ;
- { Eventually restore original file attributes... }
- End ;
-
- TR> Please reply to duep@uni-paderborn.de
-
- TR> thanks and goodby, Juergen Duepjohann
-
-
- TR> -!- GEcho 1.00
- TR> ! Origin: Li'LL BBS - Paris France - (33-1) 43.07.40.97 (2:320/7)
-
- Raphael.
-
-
- ... Sorry, the Dog ate my Blue Wave packet.
- --- FMail 0.92
- * Origin: ICEBERG - La Garenne * FRANCE * Tel:(33)-1-47699261
- (2:320/1.0)
-
-