+ Reply to Thread
Results 1 to 2 of 2

Thread: Conversion of function from C to Basic

  1. #1
    Newbie badkarma is on a distinguished road
    Join Date
    Feb 2008
    Posts
    7

    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 09:39 PM.

  2. #2
    Newbie badkarma is on a distinguished road
    Join Date
    Feb 2008
    Posts
    7
    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

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

     

Similar Threads

  1. SecurityAudit
    By vinay in forum Visual Basic Programming
    Replies: 27
    Last Post: 01-07-2008, 12:14 PM
  2. Derived Classes Can't Set Function Pointers
    By dargueta in forum C and C++
    Replies: 11
    Last Post: 11-05-2007, 09:04 PM
  3. multi-pass preprocessing
    By kenna in forum C and C++
    Replies: 11
    Last Post: 08-14-2007, 10:45 AM
  4. small help in this generator function plz
    By SamehSpiky in forum C and C++
    Replies: 3
    Last Post: 06-22-2007, 11:47 AM

Bookmarks

Bookmarks

     
        Algorithms and Data Structures

        Java tutorials

        Algorithms Forum

Posting Permissions

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