Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

FIX: You cannot open a file that is at least 4 GB to append or to write data by using a Visual C++ 2010 application


View products that this article applies to.

Symptoms

Consider the following scenario:
  • You create an application in Microsoft Visual C++ 2010.
  • You use the fopen() function in the application to open a file, and the function uses the r+, a, or a+ access mode.
  • You run the application, and the applicationtries to open a file that is equal to or larger than 4 gigabytes (GB).

In this scenario, the file does not open, or the following error is returned:  
EINVAL (Invalid argument)

↑ Back to the top


Cause

This issue occurs because of the way that the fopen() function seeks to the ends of files after it opens the files for appending. The fopen() function internally uses the _lseek() function to perform this action. However, the _lseek() function cannot handle files that are equal to or larger than 4 GB.

↑ Back to the top


Resolution

This hotfix changes the behavior of the fopen() family of functions. After you apply this hotfix, the fopen() function internally uses a function that can seek beyond the 4 GB limit without returning an error. Specifically, the fopen() function uses the _lseeki64() function instead of the _lseek() function.

Hotfix information

A supported hotfix is now available from Microsoft. However, it is intended to correct only the problem that this article describes. Apply it only to systems that are experiencing this specific problem.

To resolve this problem, 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 website: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

To apply this hotfix, you must have Microsoft Visual Studio 2010 Service Pack 1 (SP1) installed.

Restart requirement

You may have to restart the computer after you install this hotfix if the affected files are being used.

Hotfix replacement information

This hotfix does not replace a previously released hotfix.

File information

The global version of this 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.

For all supported versions of Microsoft Visual Studio 2010 SP1

File nameFile versionFile sizeDateTimePlatform
Mfcm100.dll10.0.40219.36282,69615-Nov-201122:32x86
Mfcm100d.dll10.0.40219.362104,72016-Nov-201100:29x86
Mfcm100u.dll10.0.40219.36282,70415-Nov-201122:32x86
Mfcm100ud.dll10.0.40219.362106,25616-Nov-201100:29x86
Mfcm100.dll10.0.40219.36293,96015-Nov-201121:54x64
Mfcm100d.dll10.0.40219.362120,59215-Nov-201123:56x64
Mfcm100u.dll10.0.40219.36293,96815-Nov-201121:54x64
Mfcm100ud.dll10.0.40219.362122,12815-Nov-201123:56x64
Mfcmifc80.dll10.0.40219.36214,09616-Nov-201121:26x86

↑ Back to the top


More Information

For more information about another hotfix package that applies to Microsoft Visual C++ 2010 Service Pack 1 (SP1) Redistributable Package, click the following article number to view the article in the Microsoft Knowledge Base: 

2606060  FIX: You cannot open a file that is at least 4 GB to append or to write data by using an application that uses the Visual C++ 2010 Redistributable Package


For more information about the fopen() and _wfopen() functions, visit the following MSDN website:

↑ Back to the top


Status

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

↑ Back to the top


Keywords: kbqfe, kbhotfixserver, kbfix, kbexpertiseadvanced, kbhotfixdev, kbsurveynew, kb

↑ Back to the top

Article Info
Article ID : 2606069
Revision : 1
Created on : 1/7/2017
Published on : 1/30/2012
Exists online : False
Views : 341