Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include "unistd.h"
#include "stdio.h"
/* Reads one line of data and produces the LRC of all the bytes read. */
int main ( int argc, char* argv[] )
{
char buf[1];
int n, lrc = 0;
while ( n = read(0, buf, 1) > 0 ) /* read one byte from std::in */
{
if ( buf[0] == '\n' )
break;
lrc ^= buf[0];
}
printf("LRC = %02X\n", lrc);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.