#### CFile::GetLength error in processing HUGE file.

Hi��

I have a question about my VC6 app.
I read a huge binary file, which is >4GB.
An exception will throwed when I run to the code below:

....
dwSrcLen = (unsigned long)fileSrc.GetLength(); <--- this row of code results
in error!
....

My app hangs in EINCORE.CPP, and the debug message is:
CFile exception: generic, File Unknown, OS error information = 87.

Any helps? Thanks.


 0
7/4/2005 8:45:21 AM
vc.mfc 33608 articles. 0 followers.

3 Replies
1827 Views

Similar Articles

[PageSpeed] 47

David,
You do know that the largest integer that can be stored in a 32-
bit unsigned long is 4 gig, right?  So, clearly you are not going to get
the value you want into a DWORD.  I don't remember how GetLength() is
defined in VC6, but in VC7.1, it's a ULONGLONG (64-bit unsigned).
I don't know what the file EINCORE.CPP is, but I'm pretty sure
it's not part of the MFC source.

In article <ubAoRPHgFHA.3304@TK2MSFTNGP12.phx.gbl>,
David_Wang_Xian@hotmail.com says...
> I have a question about my VC6 app.
> I read a huge binary file, which is >4GB.
> An exception will throwed when I run to the code below:
>
> ...
> dwSrcLen = (unsigned long)fileSrc.GetLength(); <--- this row of code results
> in error!
> ...
>
> My app hangs in EINCORE.CPP, and the debug message is:
> CFile exception: generic, File Unknown, OS error information = 87.

 0
7/4/2005 10:47:58 AM
Sorry for my spelling mistake: not EINCORE.CPP, but WINCORE.CPP, which is
part of MFC.
In VC6, return value of GetLength() is defined as DWORD. Then, what can I do
to get length of huge file?
Thanks.

"Scot T Brennecke" <ScotBspamhater@MVPs.org> ????
news:MPG.1d32cfdb6059d7ff989c62@msnews.microsoft.com...
> David,
> You do know that the largest integer that can be stored in a 32-
> bit unsigned long is 4 gig, right?  So, clearly you are not going to get
> the value you want into a DWORD.  I don't remember how GetLength() is
> defined in VC6, but in VC7.1, it's a ULONGLONG (64-bit unsigned).
> I don't know what the file EINCORE.CPP is, but I'm pretty sure
> it's not part of the MFC source.
>
> In article <ubAoRPHgFHA.3304@TK2MSFTNGP12.phx.gbl>,
> David_Wang_Xian@hotmail.com says...
> > I have a question about my VC6 app.
> > I read a huge binary file, which is >4GB.
> > An exception will throwed when I run to the code below:
> >
> > ...
> > dwSrcLen = (unsigned long)fileSrc.GetLength(); <--- this row of code
results
> > in error!
> > ...
> >
> > My app hangs in EINCORE.CPP, and the debug message is:
> > CFile exception: generic, File Unknown, OS error information = 87.


 0
7/5/2005 7:36:15 AM
Use the raw API to do this.

LARGE_INTEGER length;

then either
length.LowPart = ::GetFileSize(fileSrc.m_hFile, &length.HighPart);

or

::GetFileSizeEx(fileSrc.m_hFile, &length);

in either case, you will have the file length in length.QuadPart.

Microsoft has had a lot of problems getting MFC to "grow up" to the 32-bit world, and this
is one of the more egregious failures. It only took about a decade to get this problem
fixed in VS7.

Note that according to the docs, m_hFile is declared a UINT, so I think you may have to
add a (HANDLE) cast to it to get the above to compile.
joe

On Tue, 5 Jul 2005 15:36:15 +0800, "David" <David_Wang_Xian@hotmail.com> wrote:

>Sorry for my spelling mistake: not EINCORE.CPP, but WINCORE.CPP, which is
>part of MFC.
>In VC6, return value of GetLength() is defined as DWORD. Then, what can I do
>to get length of huge file?
>Thanks.
>
>"Scot T Brennecke" <ScotBspamhater@MVPs.org> ????
>news:MPG.1d32cfdb6059d7ff989c62@msnews.microsoft.com...
>> David,
>> You do know that the largest integer that can be stored in a 32-
>> bit unsigned long is 4 gig, right?  So, clearly you are not going to get
>> the value you want into a DWORD.  I don't remember how GetLength() is
>> defined in VC6, but in VC7.1, it's a ULONGLONG (64-bit unsigned).
>> I don't know what the file EINCORE.CPP is, but I'm pretty sure
>> it's not part of the MFC source.
>>
>> In article <ubAoRPHgFHA.3304@TK2MSFTNGP12.phx.gbl>,
>> David_Wang_Xian@hotmail.com says...
>> > I have a question about my VC6 app.
>> > I read a huge binary file, which is >4GB.
>> > An exception will throwed when I run to the code below:
>> >
>> > ...
>> > dwSrcLen = (unsigned long)fileSrc.GetLength(); <--- this row of code
>results
>> > in error!
>> > ...
>> >
>> > My app hangs in EINCORE.CPP, and the debug message is:
>> > CFile exception: generic, File Unknown, OS error information = 87.
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

 0
newcomer (15972)
7/5/2005 3:15:56 PM

Similar Artilces:

I am working with MFC VC++6 and want to read a file that I created and display the contents of the file to a message box. The file has one character 'a' at position 1. Here is my code: const int MAX_STRING_LENGTH = 10; CString MyString; MyFile.Open("...MyfilePath", CFile::modeNoTruncate | CFile::modeRead ); char* TempBuf = MyString.GetBuffer(MAX_STRING_LENGTH); UINT NumChars = MyFile.Read((void FAR*) TempBuf, MAX_STRING_LENGTH - 1); MyString.ReleaseBuffer(NumChars); AfxMessageBox(MyString); Unfortunately I get an exception error. Does anyone know what I am doing w...

Publisher 2002 Application Error
After starting Publisher any action (e.g. open file, help\about, etc.) the following message appears: MSPUB.EXE-Application Error The instruction at "0x77f580db" referenced memory at "0x00000000". The memory could not be "written". Clik on OK to terminate the program. Does anyone know what the problem really is and what the fix is? Check back against your previous requests for information on this matter. -- ...

error: The symbol $US:FTSE Im running Money 2000 (UK version) and Im getting this error when Im online. I know people have asked before but Ive reinstalled XP and all my software and lost the info. The error coming up is:- ------------------------------------------------------------------------------------- Online Quotes and Exchange Rates: Money was unable to retrieve a quote for FTSE (London). The symbol$US:FTSE is invalid. To correct an invalid or expired symbol, go to the Details for that investment from the Portfolio and correct or delete the symbol. Internet Information: Your call was completed success...

Error Code 2046 when sending emails.
Hi I have an Access 2003 database which is used to maintain membership records for a charity. On a member's record there is a button which sends an email to the member. On my new computer I have windows 7 home premium and I am using Windows Live email linked to my ISP. This worked fine on my old computer with Windows XP and Outlook Express. When I click on the button I now get the message Error Code 2046 The Command or Action SendObject isn't available now. The code is: Private Sub btnEMail_Click() Dim vMessage As String On Error GoTo ErrorCode ...

Exchange Error 9325
Hi, I am getting this error because we start out dl's with # I can't get this policy changed from a parent company so is there anyway to stop generating these errors? ...

Could Not Lock File error message
I am running a database on my c:\ drive, but just starting today, I am receiving a "Could not lock file" error message when attempting to open the database. I've used this database for quite some time and just now received this message. Any ideas? Thanks! Reboot the computer but do not start the database. Next open up Windows Explorer and go to the folder that holds the database file. Is there a file with the same name but ends in .ldb or .laccdb? If so, delete it. -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicy...

I have a very large 2-dimensional character array (50K words). Using the CComboBox::AddString I loop through the array and populate my Combobox. Unfortunately, I get a linker compiler error. Any help would be appreciated. Thanks, RABMissouri What does the Array or Combobox have to do with that linker? The solution is to throw away the computer and get a new one. (just kidding of course) But seriously, what is the linker error!? AliR. "RAB" <rabmissouri@yahoo.com> wrote in message news:1143679828.069072.48800@v46g2000cwv.googlegroups.com... > I have a very large 2...

Paybale Batch pops up error message for all users
Unhandled script exception: Index 0 of array 'VerifyBatchTotals' is out of range in script 'Batch_Lookup_Scrolling_Window SCROLL_FILL'. Script terminated. EXCEPTION_CLASS_SCRIPT_OUT_OF_RANGE SCRIPT_CMD_INDEX and it pop up another error message: And it says the batch has been deleted and when we click again, it go back to normal view Please help Any body has resolution for that?????????? its very urgent please help Dear All, One of my client is getting following error when he click on lookup of batch in purchasing. Transaction>>>>Purchasing>>>&g...

Outlook 2000 generating errors
As soon as I click on Find/Advanced Find in inbox of Outlook 2000 I get the message "OUTLOOK.exe has generated errors and will be shut down by windows". The same thing happens when I select "find all related messages" for an individual email. I'm running win2000 and have installed all available updates for Office 2000. Present Outlook version is SP-3. The Office software was pre-installed by Dell. I've been really frustrated by this for some time. Any ideas out there? ...

Sync Money Files
I have a laptop and desktop, both running Money 07. I have been away from home for three months and have been keeping my expenses in Money on my laptop. My wife has been keeping our records on the desktop. My problem is how to combine the two files so that I have one set of money files. When I cease travelling, the notebook will not be used for Money work; but the desktop will. So I need to combine the two files. Are there any solutions? Thanks, John Reid There is no easy way to do this. There aren't even many hard ones. Have you already done this or are you only pondering a re...

File Association in Dialog-Based Application
Has anyone seen any info on how to associated a file type with my dialog-based application? In order to use RegisterShellFileTypes(), I must add my document template using AddDocTemplates(). But AddDocTemplates() can't be called without a CDocument class. Thanks for any thoughts. -- Jonathan Wood SoftCircuits Programming http://www.softcircuits.com >Has anyone seen any info on how to associated a file type with my >dialog-based application? > >In order to use RegisterShellFileTypes(), I must add my document template >using AddDocTemplates(). But AddDocTemplates() ...

Need to convert an HTML file to a valid XTML file
I just found out I can edit my HTMLHelp in VS2005 I like it better that editing in the HTML Help Workshop This is an old help file, actually generated when Win help was in vogue. VS identifies many things that should be changed - line HTML not being lower case. Much of it is cosmetic - a program could fix most of it. Is there such a program. That is, one that will read an HTML file and produce a valid XTML file? Thanks in advance Frank wrote: > I just found out I can edit my HTMLHelp in VS2005 > > I like it better that editing in the HTML Help Workshop > > This i...

Decoder Error?
Can anyone give me troubleshooting tips on "Decoder Error" when I try to play a DVD? Is it possible to repair the Media Player with the OS re-installation disk? You can use this link to download the utility that checks a decoder. http://www.microsoft.com/downloads/details.aspx?familyid=DE1491AC-0AB6-4990-943D-627E6ADE9FCB&displaylang=en "Stu Habermehl" wrote: > Can anyone give me troubleshooting tips on "Decoder Error" when I try to play > a DVD? Is it possible to repair the Media Player with the OS re-installation > disk? ...

Mail Merge error
When I mail merge from a Contact, the 'mail merge recipient' dialog box in Word is always empty. None of the Contact details appear. I made sure that the correct Data fields are mapped before the merge. 1. Mail Merge error occurs on new or existing templates. 2. Mail Merge error only occurs with the Contact entity - merging with Company or Quote entities works perfectly. 3. We are using CRM 4.0 and Outlook/Office 2003. I cannot figure out why this is happening, any assitance would be most appreciated. Thanks.. I have experienced this as well using CRM 4.0 Web and Outloo...

Error at installation because Timezone issue
When I try to install CRM 3.0 I got an error: Install exception.System.Exception ...."Microsoft.Crm.Scheduling.WindowsTimeZone" at Microsoft.Crm.Scheduling.TimeZoneLoader.TimeZoneRegistryLoader(Hashtable timeZones, Hashtable timeZoneNames) at Microsoft.Crm.Scheduling.TimeZoneLoader.TimeZoneHardCodedLoader(Hashtable timeZones, Hashtable timeZoneNames) I think that it is a problem with Timezone Editor but I can't find a way to fix this problem. Can anyone help me? Thanks. Lucio Antoniolo ...

Compile Module Error (TBRun9) just won't go away
Hi there, this error seems simple enough--but it won't go away. THE ERROR: "Compile error in hidden module: TBRun9" The error appears when I open or when I close excel. I have found the KB article and I have removed all files from the XLStart folder, I have also removed all files named TBRun9. I have researched further and found that add-in programs could be to blame, so I have uninstalled ALL Adobe programs, all scansoft programs, uninstalled/reinstalled and updated office. I ran norton windoctor and fixed all errors it found. But still I have this error. I believ...

Import .txt file format into two columns and not one row
I want to know how to import a text file, comma seperated, or delineated, ..csv into Excel and have Excel display it into two columns instead of one long row. My file is a list of names and corresponding email addresses Sounds like the .csv file does not have the end of record marker set correctly. Try opening the file in Notepad or Word to see if there is anything you can use to do a Find & Replace with - assuming you don't have commas within the data, you could replace comma with comma plus Line-break (Hard Return). This will effectively give you a single column sheet when you im...

help cfile
I have a simple question This is what i have char* pFileName = "C:\\newspaper\\b run\\text.txt"; CFile f( pFileName, CFile::modeCreate | CFile::modeWrite ); loop...... CString out =(buff2+ current->address);<- right here i would like a return f.Write(out,out.GetLength()); ......... f.Close(); what i would like to know is how do i advance to the next line I have tried CString out = (buff2+ current->address+"\n"); well mabe i just have to revert back to the ofstream then cout << endl thanks kevina@ihug.com.au Use "\r\n". tankc &quo...

error signature
I have keep getting an error signature imessage n Publisher and I am unable to print my brochure. Any ideas??? Cyn wrote: > I have keep getting an error signature imessage n Publisher and I am unable > to print my brochure. Any ideas??? The "error signature" bit is just a bit of text to tell you that the next bit of information is the error signature. The error signature itself is the important bit. Just like if you saw: Telephone Number: 555 555-2176 in a message, the important data would be the number itself, not the "Telephone number" text. There sh...

cut & paste error
After several successful cut n paste actions I receive and error msg "can not empty the clipboard". When I access the office clipboard underneath Edit it's empty. What's the cause of this error. If I close Excel I'm able to resume the cut n paste but eventually the error will return. Any ideas? Your help is greatly appreciated. Hi Corey, If this is manually you can clear the clipboard at the upper right-hand icon below the clipboard titlebar on the clipboard popup. ] (View, Toolbars, Clipboard) If this has something to do with macros. You can clear the...

File Transfer Manager problems
Why do we have to be forced to use this awful File Transfer Manager to get Service Packs? I've been trying to download a service pack from Customer Source for a past couple of days. Microsoft says that firewall/proxy is blocking the download. Our very competent firewall/proxy people are struggling with this one. And mind you our firewall is not that restrictive - I can download files from many sources and have not had a problem with a site that would be blocked. Why not keep things simple? Mario Madej ---------------- This post is a suggestion for Microsoft, and Microsoft resp...

Wrong file attached. Caching?
I've been seeing a very strange problem, and it has even interfered with a job application. I am running Microsoft Office Outlook 2003 (11.8118.8122) SP2 on Windows XP Professional Version 2002 SP2. Summary: --------------- I attach the correct file to an Outlook email. My recipient receives a different file. Question: -------------- What can I do to stop this from happening? Details: ----------- Yesterday I selected all stored versions of my resume, right clicked, and selected "Open". I looked through the different file versions, found the one I wanted to use as the starti...

referenced memory error
Receiving the following error when shutting down Outlook Express, can anyone help? the instruction at "0x77f83187" referenced memory at "0x00924830", the memory could not be "written" Click on OK to terminate the program ...

Saving As Something Different then A Pub File
I've been working on a 10 page report. I've been adding pages as I go along. However, I want to email but not everyone can open Pub file. It won't save all 10 pages as a jpeg. Only one page I'm in the process of converting it into PDf. Is that the only option? Adriana wrote: > I've been working on a 10 page report. I've been adding pages as I go along. > However, I want to email but not everyone can open Pub file. It won't save > all 10 pages as a jpeg. Only one page > > I'm in the process of converting it into PDf. Is that the only opt...

Error 1402
I cannot open the adobe reader 9.2 my Windows XP system. When I attempt repair or uninstall it I get this 1402 error message and HKEY_LOCAL_MACHINE\Software|Microsoft|Windows|CurrentVersion\Run\OptionalComponents\MSFS Could not open key ... and something about not having administrative permission. I cannot locate the file and do not have a clue how to give myself adminstrative permission. I'm already logged in as such. DeeTour wrote: > I cannot open the adobe reader 9.2 my Windows XP system. When I > attempt repair or uninstall it I get this 1402 error message and ...