#include "stdafx.h" #include <io.h> #include <fcntl.h> int main(int argc, char* argv[]) { const unsigned long ntablelimit = 2147483647UL; int fh1, nretval; short nheader, nrecsize; unsigned long nnewsize, nmaxrecords; __int64 ndbfsize; nretval = 0; if( (fh1 = _open( argv[1], _O_RDWR | _O_BINARY | _O_RANDOM )) == -1 ) { printf("Error opening File!\n"); nretval = 1; } else { ndbfsize = _filelengthi64(fh1); if (ndbfsize > ntablelimit) { _lseek(fh1, 8L, SEEK_SET); _read(fh1, &nheader, 2); _read(fh1, &nrecsize, 2); nmaxrecords = (ntablelimit - nheader) / nrecsize; nnewsize = nmaxrecords * nrecsize + nheader; _chsize(fh1, nnewsize); _lseek(fh1, 4L, SEEK_SET); _write(fh1, &nnewsize, 4); _close(fh1); } } return nretval; }>Because you know that the current file size is over the limit, simply comment out this verification, so the part of the routine that shorten the file do its work.