Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ascii conversion w/ 7 bits
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00741726
Message ID:
00742487
Views:
24
>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.

That's just what I was looking for..Thanks
Allen
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform