Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ascii conversion w/ 7 bits
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00741726
Message ID:
00742290
Vues:
33
This message has been marked as the solution to the initial question of the thread.
Hi Allen,

>And finally, how does one calculate a Longitudinal Redundancy Check of this packet?
>Allen

One method:
PROCEDURE dolrc
LPARAMETERS cinstring

cinput = cinstring
numbytes = LEN(cinput)

* Takes the input string, a character at a time,
* convert to ANSI numeric and XOR with following character.
* Do the first pair to prime crcval

crcval = BITXOR(ASC(SUBSTR(cinput,1,1)),ASC(SUBSTR(cinput,2,1)))

* Now, loop through the rest

FOR x = 3 TO numbytes
  crcval = BITXOR(crcval,ASC(SUBSTR(cinput,x,1)))
ENDFOR

RETURN crcval
Just pass in your string, this will return the LRC value.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform