Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!ucbvax!bloom-beacon!eru!hagbard!sunic!dkuug!diku!terra From: terra@diku.dk (Morten Welinder) Newsgroups: comp.lang.pascal Subject: Re: TP6 - Standard Out got closed Message-ID: <1991May14.080621.29798@odin.diku.dk> Date: 14 May 91 08:06:21 GMT References: <382@galileo.rtn.ca.boeing.com> Sender: terra@rimfaxe.diku.dk Organization: Department of Computer Science, U of Copenhagen Lines: 26 rfh3273@galileo.rtn.ca.boeing.com (Dick Harrigill) writes: >I've just experienced a strange error with TP6. I'm using a function >that I've successfully used for years to check the existance of a file: > FUNCTION this_file_exists (VAR s:string) : boolean; > VAR f:file; > BEGIN > {$I-} > assign(f,s); reset(f); > this_file_exists:=(IOError=0); > close(f); > {$I+} > END; >This week, for the first time, passing a bad file name to this file >somehow closed standard output when the close(f) statement was run. >A successive statement such as writeln('Hi') yeilds a runtime error >103 - file not open. I have gotten around the problem by placing an >IF test in the function and not doing the close if the file was not >properly opened. I am, however, intrigued by this phenomenon. The >close(f) function should simply (with $I-) give an IOErorr, not >screw other things up. Can anyone give some insight? a) close() is an error if the file is not open. b) try using GETFATTR to check if the file exists.