Contents of the MANYFILZ.DOC file
M E M O R A N D U M
FROM: David W. Nixon
TO : All Turbo Pascal Wizards
SUBJ: How to Have More than 15 Files Open Simultaneously in One Program
DATE: Monday, February 26, 1990
How many of you have gotten Turbo Pascal Runtime Error 004 -- Too many files
open??? I'll bet more than a few of you have. Didn't it make you want to
scream? I also bet the first thing you did was go check your CONFIG.SYS
file and change it to FILES=100 or something big in hopes that it would make
the nasty 004 error go away. But, IT DIDN'T!
Guess what. You could put FILES=999 in your CONFIG.SYS, but that alone would
not let you have more than about 15 files open simultaneously in any Turbo
Pascal program. It turns out the secret to doing this is through a call
to MSDOS to reserve more file handle table space. Since I am a Turbo wizard
and not an MS-DOS weenie, I wrote to Borland asking them for help. Here is
the response they sent me:
February 21, 1990
Dear Mr. Nixon:
Thank you for your letter regarding Turbo Pascal.
Here is an example of a program that is able to open more than 15
files simultaneously. Note, this program will only function with
systems equipped with DOS version 3.0 or later.
I hope this information proves useful. If you have any further
question regarding Turbo Pascal, please contact us again.
Thank you for your interest in Borland International and our
After successfully testing their code, I made a few changes to it,
ZIPped it up, and am distributing it to a bunch of public BBSs in the
Washington, D.C. metropolitan area so EVERYONE can benefit from the
ability to have > 15 files open in Turbo Pascal.
Note that you have always been able to DEFINE an unlimited number of
files within a TP program. You could even perform I/O on all of them.
Everything would go fine within your program until the instant you
attempted to have > 15 or so of them open simultaneously. With judicious
file management (especially closing files which were not likely to be
accessed in the near future and reopening them when the need arose),
you were probably able (and possibly without realizing it) to avoid
David W. Nixon
806 Hatteras Circle
Waldorf, Maryland 20601-5222