Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Corrupted data
Message
From
28/08/2001 05:34:53
 
 
To
27/08/2001 16:44:45
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00549598
Message ID:
00549718
Views:
20
Word of warning...

a standard .DBF header can contain chr(0), 1, 3,6 and maybe others (I don't know what they are)

You need to strip the header then look for odd characters (remember to include chr(0)) and maybe you should allow tabs?

Maybe another solution to this is the following (Don't know which is faster)
lcStr = FileToStr('MyFile.dbf')
lcStr = Substr(lcStr, 200) && Don't know how long the header is but made a guess at 200 bytes
lcRepStr = ''
For iLoop = 32 to 256
lcRepStr = lcRepStr + CHR(iLoop)
Next
lcOutStr = StrTran(lcStr, lcRepStr, '')

If Len(lcOutStr) > 0
 ? 'We have some corruption'
Endif
>>How do I do to identify corrupted data?
>>I refer to the characters chr(1-31).
LPARAMETERS ;
>  tcString
>
>LOCAL ;
>  lnIx, ;
>  lnBadCount
>
>lnBadCount = 0
>
>FOR lnIx = 1 TO LEN(tcString) STEP 1
>  IF ASC(SUBSTR(tcString, lnIx, 1)) > 0 ;
>    AND ASC(SUBSTR(tcString, lnIx, 1)) < 32
>
>    * Character is "bad":
>    lnBadCount = lnBadCount + 1
>
>  ELSE
>    * Character is OK
>
>  ENDIF
>
>ENDFOR
>
>WAIT WINDOW "There are " + LTRIM(STR(lnBadCount)) + ;
>  " bad characters in the string."
Will Jones
Previous
Reply
Map
View

Click here to load this message in the networking platform