9 Jul
2003
9 Jul
'03
1:40 p.m.
victoriaames wrote:
Example that doesn't work : std::cout << "Expected CRC-8 : EA" << std::endl; boost::crc_optimal<8, 0x9B, 0, 0, false, false> crc_8; crc_8 = std::for_each( data, data + data_len, crc_8 ); std::cout << "Optimal CRC-8 : " << std::hex << crc_8() << std::endl;
The results I get are :
Expected CRC-CCITT : 29B1 Optimal CRC-CCITT : 29b1
Expected CRC-8 : EA Optimal CRC-8 : Û
Does anyone know why the 8 bit example does not seem to work? I haven't used this library, but judging from the output it looks to me like it's working just fine. The result is an 8-bit value, i.e. a (possibly unsigned) char, with the value 0xEA. Think about what cout does with 'char'.
-- Jim