Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!mips!news.cs.indiana.edu!maytag!watstat.waterloo.edu!dmurdoch From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Newsgroups: comp.lang.pascal Subject: Re: TP6 - Standard Out got closed Message-ID: <1991May13.224950.26135@maytag.waterloo.edu> Date: 13 May 91 22:49:50 GMT References: <382@galileo.rtn.ca.boeing.com> Sender: news@maytag.waterloo.edu (News Owner) Organization: University of Waterloo Lines: 26 In article <382@galileo.rtn.ca.boeing.com> 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. If the file doesn't exist, the Close will fail - this will cause subsequent I/O requests to be ignored, because you didn't clear IOError. I imagine the problem in this case was that you tried a reset on output after running this function. It was ignored, so output stayed closed. Duncan Murdoch dmurdoch@watstat.wateroo.edu