Prev: VFW, webcam, image format
Next: DumpStack
From: David on 4 Jul 2005 04:45 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: .... CFile fileSrc(strSrcFilePath,CFile::modeRead); 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.
From: Scot T Brennecke on 4 Jul 2005 06: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(a)TK2MSFTNGP12.phx.gbl>, David_Wang_Xian(a)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: > > ... > CFile fileSrc(strSrcFilePath,CFile::modeRead); > 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.
From: David on 5 Jul 2005 03:36 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(a)MVPs.org> ???? news:MPG.1d32cfdb6059d7ff989c62(a)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(a)TK2MSFTNGP12.phx.gbl>, > David_Wang_Xian(a)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: > > > > ... > > CFile fileSrc(strSrcFilePath,CFile::modeRead); > > 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.
From: Joseph M. Newcomer on 5 Jul 2005 11:15 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(a)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(a)MVPs.org> ???? >news:MPG.1d32cfdb6059d7ff989c62(a)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(a)TK2MSFTNGP12.phx.gbl>, >> David_Wang_Xian(a)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: >> > >> > ... >> > CFile fileSrc(strSrcFilePath,CFile::modeRead); >> > 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(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
|
Pages: 1 Prev: VFW, webcam, image format Next: DumpStack |