Path: utzoo!utgpu!attcan!uunet!ncrlnk!wright!thor.wright.edu From: demon@thor.wright.edu (Brett Kottman) Newsgroups: comp.lang.pascal Subject: Re: writing a disk file to a full disk Message-ID: <697@thor.wright.EDU> Date: 30 Sep 89 15:51:31 GMT References: <8909281232.aa13997@BONNIE.ICS.UCI.EDU> Sender: news@wright.EDU Reply-To: demon@thor.wright.edu Lines: 39 From article <8909281232.aa13997@BONNIE.ICS.UCI.EDU>, by jduarte@BONNIE.ICS.UCI.EDU: > Hello, > > I need some help on the topic of disk operations...and NO, this question > has nothing to do with my homework !!! > > Is there any easy way in TP 5.0 to tell whether a disk file is CLOSED > or OPEN...I mean, suppose that I write ASCII characters to a disk file and > then the disk becomes full...I can check for an IO error using the IOresult You can use TP's built in function to check on how much disk space is left before you do a write. In addition, you can keep track of whether a file is open by doing a check on the file type record. (pages 348-9 in the TP 4.0 manual) CONST fmClosed = $D7B0 (file is closed) fmInput = $D7B1 (file is text and reset) fmOutPt = $D7B2 (file is text and rewritten) fmInOut = $D7B3 (file is typed/untyped reset or rewritten == open file) These can be accessed in the mode field of the filevar record: current_status := filevar.mode and then checking it against the CONST values. Hope this helps. Brett Kottmann Wright State Univ. ================================================================================Committed to helping even those who's questions are releated to their homework and never obtaining a snobbish ivory tower attitude ================================================================================