Here i am implementing CRC 16 for file for file verification.
Here i append 2 bytes CRC at the end of file. When File will be received on target device than i have to calculate CRC of this file without last two bytes
Here is my data after appeneding CRC at the end of file.
test123
wU
Now when i again calculate CRC on target device than i want to ignore last two bytes.
Here i have one common function in which i open file in read mode and calculate CRC. i want to use same function for this time.
I have one solution make another function same like previous one and go up to filesize-2. but dnt want to replicate function two times. i want to delete last two bytes.
So any body have Suggestion or Solution regarding this?
Have your function take a parameter to ignore the last n bytes. Pass in 0 for normal use a 2 for that case.