Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!samsung!sdd.hp.com!uakari.primate.wisc.edu!aplcen!haven!adm!news From: CDCKAB%EMUVM1.BITNET@cunyvm.cuny.edu ( Karl Brendel) Newsgroups: comp.lang.pascal Subject: (R)Problem with TP 5.5 Reset Message-ID: <24106@adm.BRL.MIL> Date: 10 Aug 90 13:16:30 GMT Sender: news@adm.BRL.MIL Lines: 56 paul (pdm@ucrmath.ucr.edu) writes > I've been having a problem using the Reset function to determine > if a file exists, and was wondering if anybody has seen anything similar. > > The code is basically: > > var > F : file of MyOwn_type; > > [...] > > assign( F, Fname ); > > {$I-} > reset( F ); > {$I+} > > > The program produces a runtime 002 error (file not found) and dumps > me out to DOS. This unit is part of a much larger program, and other > units in the program behave properly when performing the same operation. > > Any thoughts? If your code is exactly as you've typed it here, _and_ you are being dumped to DOS immediately after the Reset() rather than somewhere later in the code, I'd expect to find a missing } somewhere ahead of the {$I-. Use the bracket-matching feature of the Turbo editor (if you don't use QEdit or another editor offering the same feature) to look for mismatched { and }. Search backwards from {$I- for the first preceding { and make sure it matches with the appropriate }. The reason I suspect this particular problem is because the program behaves as if IO checking has not been turned off but you see the $I- right in front of you--so maybe the compiler _isn't_ "seeing" it. Note that if I run the exact code you posted, I get a junk DosError and an IOResult of 2. If, however, I run this: { {$I-} reset( F ); I get dumped to DOS with a run-time error 2. Other likely suspects are conditional compilation errors and the ever-popular wild pointers. (Can you make this unit fail if you isolate it from your main program (writing a simple front end to it) and call _only_ this routine? Can you do so while insuring that no writes to pointers have occurred?) Karl Brendel Centers for Disease Control Epidemiology Program Office Home of Epi Info 5.0 Atlanta, GA