Xref: utzoo comp.lang.pascal:4876 comp.os.msdos.programmer:2423 Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cica!iuvax!bsu-cs!bsu-ucs!earlham!peters From: peters@yang.earlham.edu Newsgroups: comp.lang.pascal,comp.os.msdos.programmer Subject: Re: Statusof a msdos file after dos error Message-ID: <6032@yang.earlham.edu> Date: 14 Dec 90 11:03:05 GMT References: <2350@bnlux0.bnl.gov> Organization: Earlham College, Richmond, Indiana Lines: 28 In article <2350@bnlux0.bnl.gov>, kushmer@bnlux0.bnl.gov (christopher kushmerick) write> After a file has been opened (Via assign, reset/rewrite) what is its > Here is the exact situation: > > turbo pascal 5.0 > > I open a file. the reset/rewite occurs with success. > > Now I do an operation, and it fails, perhas, for example, because the > user took the diskette out of the drive. What is the status of the file? > Do I have to close it? Can I close it? should I close it? > > Chris Kushmerick > kushmer@bnlux0.bnl.gov <===Try this one first > kushmerick@pofvax.sunysb.edu The answer depends on whether you opened the file with reset or rewrite. If you opened it with reset, to read it, then a failed operation will leave the file uncorrupted (unless the failure is due to a dog eating the physical disk, etc.). If you opened it with rewrite or append, to write to it, then the chances are very good that any write/ln's performed between the opening of the file and the failed operation did not make it to the disk. In TP, closing a file is the way to insure that writes are flushed from the buffer and sent to the disk. Verify this by opening a file with rewrite, sending some text to the file with write/ln, and watching the light on the disk drive; it will not glow until the close command is processed. Peter Suber. Depts. of Philosophy, Computer Science. Earlham College. Richmond, Indiana 47374. 317-983-1214. peters@earlham.bitnet.