Results 1 to 3 of 3

Thread: need help

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2004
    Location
    California
    Posts
    46

    need help

    i didnt know where to ask this here or the vb section sorry if im in the wrong place but ive been trying to convert this to vb but im not having any luck if anyone can be so kind and help me read or explain it so i can understand how to maybe convert it into vb thanks
    VB Code:
    1. void encode(char * what, unsigned int length) {
    2.  
    3.         int counter, x;
    4.  
    5.         for (counter = 4; counter >= 0; counter--) {
    6.  
    7.                 if (counter != 4) what[0] ^= what[length-1];
    8.                 else              what[0] ^= (char)(length);
    9.  
    10.                 for (x = 1; x < (int)length; x++) what[x] ^= what[x-1];
    11.         }
    12. }
    13.  
    14.  
    15.  
    16. void decode(char * what, unsigned int length) {
    17.  
    18.         int counter, x;
    19.  
    20.         for (counter = 0; counter < 5; counter++) {
    21.  
    22.                 for (x = length-1; x > 0; x--) what[x] ^= what[x-1];
    23.  
    24.                 if (counter != 4) what[0] ^= what[length-1];
    25.                 else              what[0] ^= (char)length;
    26.         }
    27. }
    God told me to skin u alive

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: need help

    VB doesn't support pointers so you'll need to pass a String object rather than char*. If you're changing individual characters then you should call the ToCharArray method of the String object and then work on the elements of the resulting array. You can then create a new String when you're done. The exculsive or operator in VB is 'Xor' and it cannot be used in conjunction with an assignment like that. You need to separate the Xor and the assignment, e.g.
    VB Code:
    1. A = A Xor B
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2004
    Location
    California
    Posts
    46

    Re: need help

    thank you very much
    God told me to skin u alive

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width