Fixed windows files > 2Gb

This commit is contained in:
Federico Ponchio 2004-10-19 16:52:49 +00:00
parent c583e7b914
commit 64e6a53c0b
1 changed files with 6 additions and 3 deletions

View File

@ -59,8 +59,9 @@ void File::Redim(unsigned int elem) {
if(elem > size) {
#ifdef WIN32
LONG zero = 0;
if(INVALID_SET_FILE_POINTER ==
SetFilePointer(fp, elem - 1, 0, FILE_BEGIN))
SetFilePointer(fp, elem - 1, &zero, FILE_BEGIN))
#else
if(-1 == fseek(fp, elem - 1, SEEK_SET))
#endif
@ -79,7 +80,8 @@ void File::Redim(unsigned int elem) {
int fd = fileno(fp);
ftruncate(fd, elem);
#else
SetFilePointer(fp, elem, 0, FILE_BEGIN);
LONG zero = 0;
SetFilePointer(fp, elem, &zero, FILE_BEGIN);
SetEndOfFile(fp);
#endif
}
@ -88,7 +90,8 @@ void File::Redim(unsigned int elem) {
void File::SetPosition(unsigned int pos) {
#ifdef WIN32
SetFilePointer(fp, pos, 0, FILE_BEGIN);
LONG zero = 0;
SetFilePointer(fp, pos, &zero, FILE_BEGIN);
#else
fseek(fp, pos, SEEK_SET);
#endif