Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!ccut!titcca!etlcom!creamy!oucom2!digigw!gday From: gday@digigw.digital.co.jp (Gordon Day) Newsgroups: comp.sys.ibm.pc Subject: Retrieving the value of FILES=??? Keywords: Global File Handle Table Message-ID: <605@digigw.digital.co.jp> Date: 13 Jun 90 08:25:13 GMT Organization: Digital (We ain't DEC) Electronics, Osaka, Japan Lines: 30 I am confronted with the problem of finding out length of the global file handle table in DOS (>=3.3). I am aware of the following issues: - the system default is 8 - the per process default is 20 - int 21 function 67 can be used to increase the per process default to any value that will fit into 2 bytes. If global table length < per process length then the error is only found when an operation where a new handle is created is attempted. I am writing a program which MUST be able to find out the number of globally available file handles. The first observation is that who ever added the function 67 to MSDOS really missed the point by providing a function whose success or failure was indeterminate at the time of return. The obvious solution would be to provide either the address of the system variable which identifies the table length (unportable,and it may not exist if the table is terminated by a marker rather than an offset variable) or a complementary function which will return the table length through, say, function 68. The only (ugly) solution that I've come up with is to perform a "consume resource until failure" check where I reset the number of available handles by my program to some high value and perform a dup (int 21 function 45) on stdin until the dup call fails. At this point, I know that the #successful dups + 5 (stdin, stdout, etc) = size of the global handle table. Can you suggest something more elegant? Gordon W. Day (gday@digital.co.jp)