1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Convert 6 lines of C++ to C# or vb.net

Discussion in 'C++' started by waleednosir, Nov 28, 2010.

  1. waleednosir

    waleednosir New Member

    Joined:
    Nov 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Dear All ,

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

    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 C#.net or vb.net .


    Thank you all for your support ,

    WSN
     
    Last edited by a moderator: Nov 29, 2010
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    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?)
     

Share This Page