I am having trouble trying to get the CRC append to the test data, and print out the data with the appended crc.




#include <stdio.h>
#include <string.h>

#include "crc.h"

static unsigned long crcSum;

void
main(void)
{
// unsigned char test[] = "123456789";
unsigned char test[13] = {0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x8,0x9};


/*
* Print the check value for the selected CRC algorithm.
*/

printf("Payload: 0x%X\n", test);
printf("The crcFast() of \"123456789\" is 0x%X\n", crcFast(test, strlen(test)));

crcSum = crcFast(test, strlen(test));
// printf("Payload is 0x%X\n", test);
// printf("CRC is 0x%X\n", crcSum);

// Add CRC To message
*(unsigned long *)&test[9] = (unsigned long)crcSum /*crcSum*/;

printf("Payload with CRC Appended: 0x%X\n", *(unsigned long *)&test[9]);




} /* main() */