Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPD25 Manually correct 30 bytes of a corrupted Table hea
Message
From
25/08/2004 10:39:37
 
 
To
25/08/2004 06:29:01
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00936241
Message ID:
00936304
Views:
32
This message has been marked as the solution to the initial question of the thread.
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform