*** Sometimes it might be easy to remove dbc references in tables with a program.
*** Here it is.
* ClearDBCRef.prg
close all
set safe off
dimension dbfhdr[32]
cInfile=space(30)
CLEAR
@ 5,5 say 'Name DBF with extention ' get cInfile
READ
cInfile = ALLTRIM(cInfile)
STORE FOPEN(cInfile,12) TO fh && Open the file readwrite
DO readheader
nFirstRefByte = dbfhdr[9]+dbfhdr[10]*256 - 263
* jump to byte 'END OF HEADER', 0x0d
=FSEEK(fh,nFirstRefByte-1,0)
* check End Of Header byte
nEOHbyte = ASC(FREAD(fh,1))
IF nEOHbyte = 13
** write 263 '0x00' bytes
=FWRITE(fh,replicate(chr(0),263),263)
=FCLOSE(fh)
ELSE
? 'Something is wrong with the structure'
? 'The End of Header byte not found at its supposed place'
? 'No changes have been made'
ENDIF
RETURN
procedure readheader
=FSEEK(fh, 0,0) && Move pointer to first byte
nbytecount=1
do while nbytecount < 33
dbfhdr[nbytecount] = ASC(fgets(fh,1))
nbytecount=nbytecount+1
enddo
return
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.