
Its amazing how "big" is relative these days. My first computer had a
$1,500 Micropolis 10 meg drive! :)
BTW, it (the code posted) should not be an issue when just streaming
in a file of any size.
The problem begins when seeking a file.
When seeking is required, we know by using the 64 bit WIN32 file I/O
functions that it works for large +2gig files.
In one part of our server product file handing, a ISAM database with
four key index files have DWORD position indices. Issues occur as the
database grows and a index goes beyond a 32 bit value. A documented
limitation but a limitations that is not outdated.
A simple solution in the works was to use the 64 bit extended file I/O
functions which offer QUAD (double DWORD) positions. Its about to be
implemented in new major revision of our server.
For backward single source compatibility, I produced a header and
wrapper functions. Here is the *.h and *.cpp files:
//------------------------------------------------------------
// File Name : ss64lib.h
//------------------------------------------------------------
TINT ssFileSeek(HANDLE hf, TINT distance,
WORD MoveMethod = FILE_BEGIN);
TINT ssFileEnd(HANDLE hf);
TINT ssFilePos(HANDLE hf);
BOOL ssFileRewind(HANDLE hf);
BOOL ssFileLock(HANDLE hf, TINT Offset, TINT nBytes);
BOOL ssFileUnlock(HANDLE hf, TINT Offset, TINT nBytes);
TFILESIZE ssFileSize(HANDLE hf);
//------------------------------------------------------------
// File Name : ss64lib.cpp
//------------------------------------------------------------
TINT ssFileSeek(HANDLE hf, TINT dist, WORD method)
{
LARGE_INTEGER li;
li.QuadPart = dist;
li.LowPart = SetFilePointer (hf, li.LowPart, &li.HighPart, method);
if (li.LowPart == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
li.QuadPart = -1;
}
return li.QuadPart;
}
BOOL ssFileRewind(HANDLE hf)
{
return ssFileSeek(hf,0,FILE_BEGIN) == 0;
}
TINT ssFilePos(HANDLE hf)
{
return ssFileSeek(hf,0,FILE_CURRENT);
}
TINT ssFileEnd(HANDLE hf)
{
return ssFileSeek(hf,0,FILE_END);
}
BOOL ssFileLock(HANDLE hf, TINT Offset, TINT nBytes)
{
LARGE_INTEGER fp, nb;