• Content Count

  • Joined

  • Last visited

About Rico

  • Rank
  1. I am attempting to recreate a bit of C code into VB code however it is not cooperating. I have sample input and output of what the results should be in C lanugage but I have been unable to make a function in VB6 which will emulate the action. Simply put, I need to create a 16 bit CRC CCITT check that will produce the following... '// The following code is what I intend to accomplish (but have been unable to) in VB6 with actual inputs and actual results '//BEGIN Dim B(2) as Byte Dim s as String B(0) = 0 B(1) = 88 By(2) = 1 s = CRC16( s = "47EB" '//END '// The following code is what I have been provided with in C language, supposedly it is the code that is '// used to produce the above information // BEGIN unsigned short CRC(unsigned char *s, int len, unsigned short crcv) { register unsigned c,q; for (; len; len--) { c = *s++; q = (crcv ^ c) & 017; crcv = (crcv >> 4) ^ (q * 010201); q = (crcv ^ (c >> 4)) & 017; crcv = (crcv >> 4) ^ (q * 010201); } return (crcv); } //END '// So far I have been unable to get any translated code to work in VB6, I always get overflows. I am not skilled with C languages unfortuantly. '// Any help would be greatly appreciated