dickiebird
Programmer
I have a corrupt index file I'm attempting to fwrite out to a flat file, to recreate the index later.
So far so good, I fwrite out several thousands of records, then get to a point in the faulty
index where the data is not as per the 20 bytes of each record. (There's binary content in all records too)
As I'm freading 20 bytes each time, the next record is mis-aligned, as are all others.
e.g
.xPEäù cAS94 )ÿÿÿÿ
.xPEäùs cUL43 )ÿÿÿÿ
) )ÿÿÿÿ ÿÿÿÿ/÷æ äiù < this example has 24 bytes
.xPFäùs cUL43 )ÿÿÿÿ
.xMFäùs c313090)ÿÿÿÿ
)ÿÿÿÿ/÷æ äiù ÿÿÿÿ/÷æÿÿÿÿ/÷æ+++ < this example has 32 bytes
The only consistent factor in valid records are the AlphaNumeric codes in positions 11 to 16 ( always minimum 4 chars A-Z or 0-9 and spaces. Max size is 6 chars )
Anybody able to show me how to only get 'valid' records?
Perhaps by finding 4 chars in a row (in A-Z, ,0-9), seeking back 10 chars and freading 20
bytes ??
Thanks in advance
;-) Dickie Bird
Honi soit qui mal y pense
So far so good, I fwrite out several thousands of records, then get to a point in the faulty
index where the data is not as per the 20 bytes of each record. (There's binary content in all records too)
As I'm freading 20 bytes each time, the next record is mis-aligned, as are all others.
e.g
.xPEäù cAS94 )ÿÿÿÿ
.xPEäùs cUL43 )ÿÿÿÿ
) )ÿÿÿÿ ÿÿÿÿ/÷æ äiù < this example has 24 bytes
.xPFäùs cUL43 )ÿÿÿÿ
.xMFäùs c313090)ÿÿÿÿ
)ÿÿÿÿ/÷æ äiù ÿÿÿÿ/÷æÿÿÿÿ/÷æ+++ < this example has 32 bytes
The only consistent factor in valid records are the AlphaNumeric codes in positions 11 to 16 ( always minimum 4 chars A-Z or 0-9 and spaces. Max size is 6 chars )
Anybody able to show me how to only get 'valid' records?
Perhaps by finding 4 chars in a row (in A-Z, ,0-9), seeking back 10 chars and freading 20
bytes ??
Thanks in advance
;-) Dickie Bird
Honi soit qui mal y pense