I have a C program to calculate crc of a message that is represented in hex numbers:
unsigned int CRC_Check(unsigned char *ucCRC_Buf, unsigned char ucBufLength)
{
//calculate crc
return calculated_crc;
}
int main(void)
{
unsigned int crc=CRC_Check("\x00\x01\x90\x16\x55\x00\x2c\x10\x01\x01\x01\x0e\x10\x10\x01\x01\x01\x3a\x11",19);
printf("%x\n",crc);
return 0;
}
Now I need to pass the message to the program as argument:
./crc 0001901655002c100101010e10100101013a11
I know that main declaration should look like this:
int main(int argc, char *argv[])
and that argv[1] is my message. How do I achieve so the program sees it as individual bytes so I can do something like this:
unsigned int crc=CRC_Check(argv1_as_hex_bytes,19);
Thanks!