Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
LRC - Longitudinal Redundancy Check?
Message
De
12/07/2002 17:53:06
 
 
À
12/07/2002 16:30:23
Allen Hanna
H. A. Hanna Associates
Indianola, Indiana, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00678269
Message ID:
00678298
Vues:
24
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform