Closed Thread
Results 1 to 2 of 2

Thread: Conversion of function from C to Basic

  1. #1
    badkarma is offline Newbie
    Join Date
    Feb 2008
    Posts
    7
    Rep Power
    0

    Conversion of function from C to Basic

    Hello There,

    I am having terrrible trouble getting my head round certain bits of C - namely compound operators.

    I have been programming in BASIC since the early 80s and then moved on to Turbo Pascal in the late 80s, then coding in ASP/HTML / Visual BASIC since the mid 1990s.

    I cam also tinker in Javascript, but have come acrosss a need to convert a program from C to Basic.

    Most of it I have done, but there are one or two routines which I cannot get my head around, no matter how hard I try...

    Can anyone shed any light ... I need to convert the following from C to VB / Basic.



    long XCH;
    int Xoptions;

    void mybits (short bit); {
    printf ( (XCH & (1L<<bit))!=0);
    XCH |= (1L<<bit) );
    XCH &=~ (1L<<bit );
    }


    void myoption (int option); {
    Xoptions |= option;
    Xoptions &=~ option;
    XOptions ^= option;
    }




    I have looked around and I know voids are like subroutines which I am passing parameters through to (bit and option), and I know that I have two global variables set up (XCH and XOptions), but I cannot get my head around the compound operators ... I think SHL and SHR come into it somewhere ... can anyone point me in the right direction to understand the above by replying with a VB equivalent of the above statements?

    Many thanks.

    Steve.
    Last edited by badkarma; 02-26-2008 at 07:39 PM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    badkarma is offline Newbie
    Join Date
    Feb 2008
    Posts
    7
    Rep Power
    0
    Found this ...

    Bitwise operation - Wikipedia, the free encyclopedia

    which seems to explain alll... woohoo

    so I guess I can use SHL SHR OR XOR And etc in BASIC

    I guess I have answered my own question ... hope this is useful to others

    xxx

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. conversion from c to c++
    By ogopa in forum C and C++
    Replies: 3
    Last Post: 07-26-2011, 08:30 AM
  2. Conversion
    By mr mike in forum C and C++
    Replies: 4
    Last Post: 03-28-2011, 12:13 AM
  3. Replies: 4
    Last Post: 01-01-2011, 09:24 AM
  4. Replies: 3
    Last Post: 11-12-2010, 05:47 PM
  5. basic function in c++
    By jwxie518 in forum C and C++
    Replies: 3
    Last Post: 06-29-2009, 09:00 AM

Tags for this Thread

Bookmarks

Posting Permissions

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