Handling files larger than 4GB
-
Hi all, I am trying to work with video files larger than 6GB. The MFC file classes use DWORD's for position and length, which limits them to 4GB. I knwo there are equivalents for routines like CFileFind::GetLength or CFile::GetPosition, etc. but I can't seem to find them. Does anyone have an idea? Thanks in advance. William
-
Hi all, I am trying to work with video files larger than 6GB. The MFC file classes use DWORD's for position and length, which limits them to 4GB. I knwo there are equivalents for routines like CFileFind::GetLength or CFile::GetPosition, etc. but I can't seem to find them. Does anyone have an idea? Thanks in advance. William
William Engberts wrote:
CFileFind::GetLength or CFile::GetPosition, etc
U can use the API's directly.
GetFileSizeEx() SetFilePointerEx()
nave [OpenedFileFinder]
-
Hi all, I am trying to work with video files larger than 6GB. The MFC file classes use DWORD's for position and length, which limits them to 4GB. I knwo there are equivalents for routines like CFileFind::GetLength or CFile::GetPosition, etc. but I can't seem to find them. Does anyone have an idea? Thanks in advance. William
Not sure what version of VS you are using, but the file handing classes in the MFC (CFile etc) were updated to handle large file sizes. So the CFile::GetPosition() now returns a ULONGLONG, Seek() has a LONGLONG parameter...and so forth. I now about the file limitation for VS6, but for the MFC 7.0 (VS7.1), these were updated.
I Dream of Absolute Zero
-
Hi all, I am trying to work with video files larger than 6GB. The MFC file classes use DWORD's for position and length, which limits them to 4GB. I knwo there are equivalents for routines like CFileFind::GetLength or CFile::GetPosition, etc. but I can't seem to find them. Does anyone have an idea? Thanks in advance. William
you may use CreateFileMapping and ViewMapOfFile to map such files into your process address,__int64 will be ok. DWORD dwFileLo = ::GetFileSize(hFile,dwFileHi); ASSERT(dwFileLo != INVALID_FILE_SIZE); __int64 qwFileSize = dwFileHi << 32 | (dwFileLo & 0XFFFFFFFF);
Later buggers harm more.