[comp.lang.pascal] Turbo Pascal and DOS file handles

NCLARKE%DREW.BITNET@wiscvm.wisc.EDU (09/18/87)

  It appears that Turbo Pascal version 3 bypasses the standard DOS calls
for opening files... well sort of.  Let me tell you what I did and maybe
someone out there can help me with the problem.

  According to page 220 of the turbo manual, an integer absolute on a file
name will give me its file handle, as used by DOS.  I have used this and
found it to be a useful way of debugging programs that get the "too many
open files" error (because I forgot to close something), by the way.

  Anyhow, I have a situation in my program where it must do an emergency
re-execution of the program instead of unwinding its way back to the beginning
and looping.  If I don't close all the files, Turbo leaves them open.  This
caused me many a nightmare!  So, I wrote a procedure that closed all the
file handles that I had in use (not the system file handles, just mine), and
it worked.  (The next file used by Turbo had a file handle I had just freed)
The problem was that Turbo didn't realize the file was closed.  It insists
that it closes all files with the close procedure (or other built in features)

  So, here is my question.  Does Turbo keep an internal count on the number
of open files?  and if so, where is it?

  I've tried most everything, and now manually close every file by name with
the close procedure but I don't like that solution.  Especially when there
could be any number of a possible 25 files open at a given point that the
emergency reset can occur during.

   -Neil Clarke
    nclarke@drew.bitnet
    Drew Underground BBS 201-377-8193,8245,786
I71d n