Increased File Libraries for Visual C++ 2.0-2.2 Available (124520)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 2.1
- Microsoft Visual C++, 32-bit Editions 2.2
This article was previously published under Q124520 SUMMARY The run-time libraries have a preset limit on the number of
files you can have open at one time as described in the More Information
section of this article. You can, however, increase these limits by
downloading the Increased File Handle Libraries for Microsoft Visual C++,
32-bit Edition, versions 2.0, 2.1 and 2.2. Download Vc20xf.exe for Visual C++
2.0, or Vc22xf.exe for Visual C++ 2.1 and 2.2. The following files are available for
download from the Microsoft Download
Center: Vc20xf.exeVc22xf.exe For additional information about how
to download Microsoft Support files, click the following article number to view
the article in the Microsoft Knowledge Base: 119591 How to Obtain Microsoft Support Files from Online Services
Microsoft scanned this file for viruses. Microsoft used the most
current virus-detection software that was available on the date that the file
was posted. The file is stored on security-enhanced servers that help to
prevent any unauthorized changes to the file.
For more information about downloading files from the
Microsoft Software Library, please see the following article in the Microsoft
Knowledge Base: 119591
How to Obtain Microsoft Support Files from Online Services
MORE INFORMATIONPreset Limits Attempting to open more than 64 file handles (or 20
file streams) concurrently in a process will fail if you are creating a single-
threaded application that uses the static run-time library (LIBC.LIB) by using
the /ML compiler option (the default). Attempting to open more than
256 files handles (or 40 file streams) concurrently in a process will fail if
you are using the static multi-threaded run-time library by using the /MT
compiler option and LIBCMT.LIB. The same limit applies if you use the DLL
version of the run-time library by using the /MD compiler option and MSVCRT.LIB
or MSVCRT20.DLL. Increased Limits Using the Files in VC20XF.EXE & VC22XF.EXE VC20XF.EXE ans VC22XF.EXE include the following five files:
README.TXT | File containing instructions on use of
these .LIBs | LIBC.LIB | Single threaded run-time library | LIBCMT.LIB | Multi-threaded run-time library | MSVCRT2X.LIB | Import library for MSVCRT2X.DLL | MSVCRT2X.DLL | Multi-threaded run-time library in a
DLL. |
These run-time libraries have been rebuilt to allow
the use of up to 509 file handles and up to 125 file streams in an application.
The total is actually 512 handles and 128 streams, but three handles and
streams are used by the run-time library for the standard C input/output/error
files, stdin, stdout, and stderr. Note that each stream (FILE*) uses a handle,
so the two limits are not independent of each other. When building
your application, the libraries must be in your current directory, or in a
directory specified by the LIB environment variable. If you place them in the
\MSVC20\LIB directory, make a backup copy of the existing libraries of the same
name. For MSVCRT2X.LIB to be used as a default library, you must
rename it to MSVCRT.LIB. If you use this library, MSVCRT2X.DLL must be in the
path or in the Windows system directory. You may distribute MSVCRT2X.DLL with
applications built with MSVCRT2X.LIB. These files are provided for
the convenience of Visual C++ users; they are provided as is without any
support. File handles are obtained when you use the low-level I/O
functions (_open and _sopen, and _creat) to open a file. When one of these
functions fails because the application has reached the file limit, they will
return -1, and set the global variable errno to the constant EMFILE. EMFILE is
defined in ERRNO.H as 24. File handles are also associated with the
iostream classes. When a member function or constructor of an iostream class
fails because the application has reached the file limit, the bad member
function will return a nonzero value. Note that many other types of errors can
also cause the bad member function to return a nonzero value. File
streams are associated with the stream I/O functions (fopen, _fdopen, and
_fsopen). When one of these functions fails because the application has reached
the file limit, they will return NULL. Note that many other types of file
stream errors can also cause the functions to return NULL. NOTE: You
must call SetHandleCount() to increase the number of file handles available on
WIN32s. This function changes the number of file handles available to a
process. Under Win32s, this default is 20. It has no effect when called under
Windows NT.
Modification Type: | Minor | Last Reviewed: | 8/5/2004 |
---|
Keywords: | kbdownload kbfile kbProgramming KB124520 |
---|
|