Problems with String & checksum
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/03/2008 at 08:08, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9+
Platform: Windows ; Mac ; Mac OSX ;
Language(s) : C++ ;---------
Howdy,This has really got me baffled.
I generate a serial number string that has number and letter characters in it, then do a checksum on it and add that to the end of the string, and finally add some hyphens to break up the number. This final serial number string is then displayed in a dialog's EditText gadget.
The string is then copied and pasted into another dialog that checks the checksum. It first strips the hyphens and then separates the checksum value out of the string and does a new checksum value on the remaining string. When it compares the two checksums, they're different.
When I insert GePrint() statements all along the way to track the strings characters as they're generated, they all match up perfectly. So why is the checksum different?
My work around for this is to generate the serial number string, and before adding the checksum value to the end, set the dialog's EditText gadget to the generated string. Then get the string from the dialog's EditText gadget and calculate and add the checksum to the end, and then add the hyphens, and finally set the dialog's EditText gadget to the final string. Now when I copy and past the serial number into the other dialog box and check the checksum, it matches. ;o)
So, what's the difference between the original created string and the string that I get with GetString() from the dialog's EditText gadget? They both print the same in the console. :o(
Adios,
Cactus Dan -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/03/2008 at 07:17, xxxxxxxx wrote:
Howdy,
OK, never mind.
It's because I was converting a CHAR array to a String using:
s = String(chr);
... instead of using:
s.SetCString(chr,size);When I use SetCString() it works fine. DOH!
Adios,
Cactus Dan