Convert 6 lines of C++ to C# or

waleednosir's Avatar, Join Date: Nov 2010
Newbie Member
Dear All ,

I am a , user . I have a problem with a code that has only 6 lines in C++ that I want to translate to or C# . Here is the code :

GUCHAR GenerateCkSum(GUCHAR *pure_data, U2 size)
GUCHAR chksum;
I2 i;
chksum = pure_data[0];
for(i=1; i<size ; i++)
chksum ^= pure_data[i];
return chksum;
the code calcualtes the checksum of a string . it makes for the following string "PTSI000,TSI" >>> gives a checksum of 4C. How can i make the code in or .

Thank you all for your support ,


Last edited by shabbir; 29Nov2010 at 08:38.. Reason: Code blocks
xpi0t0s's Avatar, Join Date: Aug 2004
The C# code should be pretty similar. What have you tried? Do you understand what the C++ code is doing? (If not, what exactly don't you understand?)