Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > C++

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-27-2004, 05:47 PM
Don Don is offline
Registered User
 
Join Date: Jul 2004
Posts: 137
Question LRC Longitudinal Redundancy Check

Can any one tell me how in C to calculate the LRC for a string of data? The data will contain 100 or so characters that was passed to the C program with the last character bing a ETX. After the LCR is calculated I will place STX at the beginning and the LCR at the end and send via SSL.

Thanks
Don
Reply With Quote
  #2  
Old 10-27-2004, 06:23 PM
jonnin jonnin is offline
Senior Member
 
Join Date: Dec 2003
Posts: 3,008
Blurbs from the web:

The longitudinal parity byte is created by placing individual bytes of a string in a two-dimensional array and performing a Vertical Redundancy Check vertically and horizontally on the array, creating an extra byte. This is an improvement over the VRC because it will catch an odd number of errors in the individual characters of the string.


the vertical one:

The resulting parity bit is constructed by XORing the word. The result is a "1" if there is an odd number of 1s, and a "0" if there is an even number of 1s in the word. This method is unreliable because if an odd number of bits are distorted, the check will not detect the error. The Longitudinal Redundancy Check is an improvement.

from: http://wwwacs.gantep.edu.tr/foldoc/f...dundancy+Check

C and C++ do not have this built in, you may be able to find a lib for free. It looks simple enough to code if not.
Reply With Quote
  #3  
Old 10-27-2004, 09:41 PM
Don Don is offline
Registered User
 
Join Date: Jul 2004
Posts: 137
Thanks for the reply. I have scanned the web and have yet to find enough details to know how to code this. I will keep looking as my skill set is not string enough to code this from scratch.
Don
Reply With Quote
  #4  
Old 10-27-2004, 09:54 PM
jonnin jonnin is offline
Senior Member
 
Join Date: Dec 2003
Posts: 3,008
I have no idea of the value of this:


http://www.linuxquestions.org/questi...003/08/4/25543

//from a forum
char GetLrcChar(char *data, int len)
{
int i;
char tmp = data[0];
for(i = 1; i < len; i++)
tmp = tmp^data[i];
return tmp;
}

...
method posted is sufficient //a comment about the code -- J
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 10:30 AM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.