parameters tcTableName >#define TableLimit 2*1024*1024*1024 >tcTableName = tcTableName + ".dbf" && Warning - no check here >handle=fopen(tcTableName,2) >lnFileSize=fseek(handle,0,2) && File size >if lnFileSize > TableLimit > Hsize=getword(handle,8) && Header() > Rsize=getword(handle,10) && Recsize() > lnMaxRecords = floor((TableLimit - Hsize) / Rsize ) && Max records allowable > lnNewSize = lnMaxRecords * Rsize + Hsize > =fchsize(handle, lnNewSize) && Resize file > =putlong(handle,4,lnMaxRecords) && Reset reccount() in header >endif >=FCLOSE(HANDLE) > >************************************************************************** >* getbyte : get a single byte at position specified by pos from a file opened >* with low level functions (handle comes from that function) >* getword : >* get a word size integer in hex format >* parameters : handle - file handle got by fopen() or alike >* pos - file position to get word >* lr - (Logical) if .T. left-to-right format used >* if .F. or not passed right-to-left format used >* (more likely to be used with low level) >* EXAMPLE : >* getword(handle,12) - returns 62313 if bytes at offset 11 are ( 69 F3 ) >* getword(handle,12,.T.) - returns 62313 if bytes at offset 11 are ( F3 69 ) >* >* getlong : same as putword except gets 4 bytes >************************************************************************** >function getbyte >parameters handle,pos >=fseek(handle,POS,0) >return asc(fread(handle,1)) > >function getword >parameters handle,pos,lr >if parameters()<3 > lr=.f. >endif >=fseek(handle,POS,0) >return asc(fread(handle,1))*iif(lr,256,1)+asc(fread(handle,1))*iif(lr,1,256) > >function getlong >parameters handle,pos,lr >if parameters()<3 > lr=.f. >endif >lowword=getword(handle,iif(lr,pos+2,pos),lr) >highword=getword(handle,iif(lr,pos,pos+2),lr) >return highword*65536+lowword > >************************************************************************** >* putbyte : write a single to position specified by pos to a file opened >* with low level functions (handle comes from that function) >* putword : >* put a word size integer in hex format >* parameters : handle - file handle got by fopen() or alike >* pos - file position to put word >* word - word that will be written >* lr - (Logical) if .T. left-to-right format used >* if .F. or not passed right-to-left format used >* (more likely to be used with low level) >* EXAMPLE : >* putword(handle,12,62313) - writes at offset 11 ; bytes ( 69 F3 ) >* putword(handle,12,62313,.T.) - writes at offset 11 ; bytes ( F3 69 ) >* >* putlong : same as putword except writes 4 bytes >************************************************************************** >function putbyte >parameters handle,pos,byte >=fseek(handle,POS,0) >written=fwrite(handle,chr(byte),1) > >function putword >parameters handle,pos,word,lr >if parameters()<4 > lr=.f. >endif >lowbyte=ceiling(word)%256 >highbyte=int(ceiling(word)/256) >=putbyte(handle,iif(lr,pos+1,pos),lowbyte) >=putbyte(handle,iif(lr,pos,pos+1),highbyte) > >function putlong >parameters handle,pos,long,lr >if parameters()<4 > lr=.f. >endif >lowword=ceiling(long)%65536 >highword=int(ceiling(long)/65536) >=putword(handle,iif(lr,pos+2,pos),lowword,lr) >=putword(handle,iif(lr,pos,pos+2),highword,lr)Cetin