home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!cs.utexas.edu!sun-barr!news2me.ebay.sun.com!cronkite.Central.Sun.COM!texsun!exucom.exu.ericsson.se!news
- From: exuptr@exu.ericsson.se (exuptr@exu.ericsson.se)
- Newsgroups: comp.lang.pascal
- Subject: Re: FILE NOT OPEN error dilemma - sup? help?
- Message-ID: <exuptr.393.714846422@exu.ericsson.se>
- Date: 26 Aug 92 16:27:02 GMT
- References: <1992Aug24.200509.8450@javelin.sim.es.com> <1992Aug24.212030.17363@nb.rockwell.com> <1992Aug25.140058.16757@javelin.sim.es.com>
- Sender: news@exu.ericsson.se
- Organization: Ericsson Network Systems, Inc.
- Lines: 51
- Nntp-Posting-Host: exupc236.exu.ericsson.se
-
- In article <1992Aug25.140058.16757@javelin.sim.es.com> tpehrson@javelin.sim.es.com (tim clinkenpeel) writes:
- >From: tpehrson@javelin.sim.es.com (tim clinkenpeel)
- >Subject: Re: FILE NOT OPEN error dilemma - sup? help?
- >Date: 25 Aug 92 14:00:58 GMT
-
- >>|> 2:begin writeln('Attack'?); if yes then begin
- >>|>**--> close(xixpf);
- >>|> combat(1,filepos(xixpf)-1); exit; end; end;
- > ^^^^
-
- >>The first thought that comes to mind is that you open the file xixpf outside
- >>the while loop and you can potentially close the file multiple times
- >>while inside the loop (depending on what filepos will return on a closed
- >>file).
-
- >as you can see, "yes" being true in this case statement will exit the
- >procedure and thus the loop so it's not possible to happen. plus, i get the
- >error on the first pass.
-
- >what's the second thought that comes to mind?
-
- I'd go into the IDE and trace this thing looking at the value of your file
- variable, xixpf. Maybe it's not opening, or maybe something is corrupting
- it. TP acts really wierd if you get an IO error and you have IO checking
- off. All subsequent IO operations fail.
-
- Again, trace the thing, if you have enough memory. If not, put some checks
- in to see if the file is open at strategic points.
-
- You can do that like this:
-
- var
- checkfile:^filerec;
-
- begin
- ...
- if checkfile^.mode = fmClosed...
-
-
- >--
- >\clinkenpeel: aberrant analytical cynical agnostic idealist. i exclusively /
- >/represent myself. i do not offend anyone; however, some morons choose to \
- >\offend themselves. judge only those who you would have judge yourself. i /
- >/don't practice what i preach - i'm not the type of person i'm preaching to.\
- ----------------------------------------------------------------------------
- "This must be Thursday. I never could get the hang of Thursdays"
- - D Adams
- - Patrick Taylor
- Ericsson Network Systems
- exuptr@exu.ericsson.se "Don't let the .se fool you"
- alternately, exuptr@ZGNews.Lonestar.Org
-