home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / pascal / 5065 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  2.7 KB

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