>If the file is not too big, you can use something like this:
>lcFile=yourfile
>lcTekst=filetostr(lcFile)
>lnLength=len(lcTekst)
>strtofile(lcFile,left(lcTekst,lnLength-30))
>NB! Not tested. And be sure to make a backup first. :-)
>
If you have VFP this should work.
Pretty sure FPD did not support FILETOSTR() and STRTOFILE() so you can probably use the low level file functions to do the same thing. Been a while since I've done this but something like
nTarget = FRCREATE(holding file name)
nSource = FOPEN(source file name)
nTotBytes = FSEEK(nSource,0,2)
=FSEEK(nHandle,0)
lcFileData = FREAD(nSource,number of good bytes)
=FWRITE(nTarget,lcFileData)
=FSEEK(nSource,number of bad bytes,1)
lcFileData = FREAD(nSource,nTotBytes)
=FWRITE(nTarget,lcFileData)
=FCLOSE(nSource)
=FCLOSE(nTarget)
and now copy the target file over the original
I'll also repeat Tore's warning..........Make backups first!!!
>>Hi all
>>
>>I have this corrupted table. the records and it's length seems to be okay, but the header has somehow got 30 characters more in it, though this longer header is still recognized by FP and still returns the right number of fields, fieldnames and lengths. I have a copy of the original table (empty table).
>>
>>I have tried to overwrite the header portion but how do I remove the 30 extra bytes? This I have seem happening before, but if just manually removing a few bytes or the header fully and the putting in the right header should give the file back as the records are unharmed.
>>
>>Please advise.