Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LRC - Longitudinal Redundancy Check?
Message
From
12/07/2002 17:53:06
 
 
To
12/07/2002 16:30:23
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00678269
Message ID:
00678298
Views:
25
Allen,
This works for us:
* Program....: LRC.PRG
* Abstract...: Computes LRC (Longitudinal Redundancy Check) for string passed in
*              Returns a single character
LPARAMETERS p_cString

IF PCOUNT()<1 OR TYPE("p_cString") <> "C"
    RETURN CHR(0)
ENDIF
LOCAL lnLRC, lnii

lnLRC = 0

FOR lnii = 1 TO LEN(p_cString)
    lnLRC = BITAND(0xFF,BITXOR(lnLRC,ASC(SUBSTR(p_cString,lnii,1))))
ENDFOR
RETURN CHR(lnLRC)
Rick

>Can anyone give me example code on doing LRC on a string?
>
>Thanks,
>Allen
Previous
Reply
Map
View

Click here to load this message in the networking platform