How To Calculate Available File Handles at Run Time (51434)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft C/C++ for MS-DOS 7.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
This article was previously published under Q51434 SUMMARY
The following code sample allows you to determine how many CRT file
handles are available at run time for a particular process. The
function makes use of the predefined pointers _iob and _lastiob, which
are set to point to the first and the last input/output information
blocks, respectively. The I/O blocks are examined to determine whether
they are in use, and a total number of available file handles is
produced. There is no equivalent C library function currently
available.
NOTE: This is not necessarily an indication of the maximum number of
physical files that can be opened. The system-wide limit is set in
MS-DOS by FILES= in the CONFIG.SYS file. In OS/2, this limit is
arbitrarily governed by system resources and is modified for each
process by DosSetMaxFH().
Modification Type: | Minor | Last Reviewed: | 6/29/2004 |
---|
Keywords: | kbCRT kbhowto KB51434 |
---|
|