Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calculate LRC
Message
From
10/07/2007 13:15:58
 
 
To
10/07/2007 13:08:22
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows XP
Miscellaneous
Thread ID:
01238986
Message ID:
01238988
Views:
20
>How to calculate the LRC (Longitudinal Redundancy Check) in VFP 8.0?

For what I saw in Wikipedia http://en.wikipedia.org/wiki/Longitudinal_redundancy_check I suppose it should be something like:
? CalcLRC([some string])



FUNCTION CalcLRC(lcStr)
LOCAL lnRetVal, lnFor
lnRetVal = 0
FOR lnFor = 1 TO LEN(lcStr)
    lnRetVal = BITXOR(ASC(SUBSTR(lcStr, m.lnFor, 1)), lnRetVal)
NEXT
RETURN m.lnRetVal
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Reply
Map
View

Click here to load this message in the networking platform