FIX: Error message when a Visual C++ 2005 application tries to open a file in debug mode in Visual Studio 2005 Service Pack 1: "Too many open files"

Article translations Article translations
Article ID: 934586 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario:
  • You create a C++ application in Microsoft Visual Studio 2005 Service Pack 1 (SP1).
  • The application uses the C run-time library to open a file.
  • You compile the application, and then you run the application in debug mode.
  • The application opens several files successfully.
  • The application opens another file unsuccessfully more than 512 times.
In this scenario, the application may be unable to open any more files, even if the paths are valid. When this problem occurs, you receive the following error message:
Too many open files

RESOLUTION

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next Visual Studio 2005 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Customer Support Services to obtain the hotfix. For a complete list of Microsoft Customer Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites

You must have Visual Studio 2005 Service Pack 1 (SP1) installed to apply this hotfix.

Restart requirement

You do not have to restart the computer after you apply this hotfix.

File information

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time item in Control Panel.
Collapse this tableExpand this table
File nameFile versionFile sizeDateTimePlatform
8.0.50727.832.policyNot Applicable81012-Apr-200719:10Not Applicable
Amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.832_x-ww_9d977ba4.manifestNot Applicable1,87112-Apr-200722:33Not Applicable
Amd64_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.832_x-ww_8715c243.manifestNot Applicable1,87912-Apr-200722:33Not Applicable
Crtassem.hNot Applicable64612-Apr-200719:10Not Applicable
Crtdefs.hNot Applicable93,73512-Apr-200719:10Not Applicable
Fp10.objNot Applicable6,08112-Apr-200719:09Not Applicable
Ia64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.832_x-ww_9ae87c64.manifestNot Applicable1,87012-Apr-200723:23Not Applicable
Ia64_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.832_x-ww_8466c303.manifestNot Applicable1,87812-Apr-200723:23Not Applicable
Libcmt.libNot Applicable7,728,83812-Apr-200719:09Not Applicable
Libcmtd.libNot Applicable9,771,95412-Apr-200719:09Not Applicable
Libcpmt.libNot Applicable4,987,96212-Apr-200719:09Not Applicable
Libcpmtd.libNot Applicable6,690,77812-Apr-200719:09Not Applicable
Microsoft_vc80_crt_x86.msmNot Applicable634,36813-Apr-200702:57Not Applicable
Microsoft_vc80_crt_x86_ia64.msmNot Applicable2,476,03213-Apr-200702:57Not Applicable
Microsoft_vc80_crt_x86_x64.msmNot Applicable1,799,68013-Apr-200702:57Not Applicable
Microsoft_vc80_debugcrt_x86.msmNot Applicable2,181,12013-Apr-200702:57Not Applicable
Microsoft_vc80_debugcrt_x86_ia64.msmNot Applicable3,983,87213-Apr-200702:58Not Applicable
Microsoft_vc80_debugcrt_x86_x64.msmNot Applicable2,287,10413-Apr-200702:58Not Applicable
Msvcm80.dll8.0.50727.832479,23212-Apr-200719:10x86
Msvcm80d.dll8.0.50727.8321,015,80812-Apr-200719:10x86
Msvcmrt.libNot Applicable944,17412-Apr-200719:09Not Applicable
Msvcmrtd.libNot Applicable983,99212-Apr-200719:09Not Applicable
Msvcp80.dll8.0.50727.832548,86412-Apr-200719:10x86
Msvcp80d.dll8.0.50727.8321,036,28812-Apr-200719:10x86
Msvcprt.libNot Applicable1,482,90212-Apr-200719:09Not Applicable
Msvcprtd.libNot Applicable1,632,60812-Apr-200719:09Not Applicable
Msvcr80.dll8.0.50727.832626,68812-Apr-200719:10x86
Msvcr80d.dll8.0.50727.8321,175,55212-Apr-200719:10x86
Msvcrt.libNot Applicable961,72612-Apr-200719:09Not Applicable
Msvcrtd.libNot Applicable992,63012-Apr-200719:09Not Applicable
Msvcurt.libNot Applicable5,958,33012-Apr-200719:09Not Applicable
Msvcurtd.libNot Applicable6,632,28012-Apr-200719:09Not Applicable
Policy_8_0_microsoft_vc80_crt_x86.msmNot Applicable84,99213-Apr-200702:57Not Applicable
Policy_8_0_microsoft_vc80_crt_x86_ia64.msmNot Applicable85,50413-Apr-200702:57Not Applicable
Policy_8_0_microsoft_vc80_crt_x86_x64.msmNot Applicable86,01613-Apr-200702:57Not Applicable
Policy_8_0_microsoft_vc80_debugcrt_x86.msmNot Applicable86,01613-Apr-200702:57Not Applicable
Policy_8_0_microsoft_vc80_debugcrt_x86_ia64.msmNot Applicable86,01613-Apr-200702:58Not Applicable
Policy_8_0_microsoft_vc80_debugcrt_x86_x64.msmNot Applicable86,01613-Apr-200702:58Not Applicable
Stream.cNot Applicable4,07612-Apr-200719:09Not Applicable
Vcredist_ia64.exe2.0.50727.8326,615,89612-Apr-200723:34x86
Vcredist_x64.exe2.0.50727.8323,183,44812-Apr-200722:43x86
Vcredist_x86.exe2.0.50727.8322,701,14413-Apr-200704:34x86
X86_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.832_x-ww_6b8d95c4.manifestNot Applicable1,86913-Apr-200702:51Not Applicable
X86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.832_x-ww_550bdc63.manifestNot Applicable1,87713-Apr-200702:51Not Applicable

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

Steps to reproduce the problem

To reproduce the problem, follow these steps:
  1. Paste the following code example into a Microsoft Visual C++ 2005 console application.
    #include <stdio.h>
    #include <stdlib.h>
    
    int main(int argc, char*argv[])
    {
        int i;
        struct FILE* f;
    
        for (i=0; i<513; ++i)
            if (i<17)
                f=fopen(argv[0], "r");
            else
                f=fopen("This file does not exist", "r");
    
        printf("Error number is: %u", errno);
    
        return 0;
    }
    
  2. Compile the application, and then run the application in debug mode. Notice that error number 24 is returned. Error number 24 displays a "Too many open files" error message.

Properties

Article ID: 934586 - Last Review: October 8, 2011 - Revision: 2.0
APPLIES TO
  • Microsoft Visual Studio 2005 Professional Edition
  • Microsoft Visual Studio 2005 Standard Edition
  • Microsoft Visual Studio 2005 Team Edition for Database Professionals
  • Microsoft Visual Studio 2005 Team Edition for Software Architects
  • Microsoft Visual Studio 2005 Team Edition for Software Developers
  • Microsoft Visual Studio 2005 Team Edition for Software Testers
Keywords: 
kbfix kbbug kbqfe KB934586

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com