Jump to content

translateing c to autoit


Recommended Posts

Hello!

I'm new to this forum to receive help and maybe I could help, too.

Actually I got a poblem by translateing a little C code to AutoIt.

I want to translate this C code:

uint modify(uint* Ptr)
{
    uint val = *Ptr;
    
    // modify
    val = val >> 7;
    
    return (*Ptr = val);
}

to Autoit.

I've tried it and I got the following result:

Func modify(ByRef $Ptr)
{
    $val = $Ptr

    ;modify
    $val = BitShift($val, 7)
    
    Return $Ptr = $val
}

Can anyone tell me if it is correct translated?

Thanks for help!

Link to comment
Share on other sites

Hello!

I'm new to this forum to receive help and maybe I could help, too.

Actually I got a poblem by translateing a little C code to AutoIt.

I want to translate this C code:

uint modify(uint* Ptr)
{
    uint val = *Ptr;
    
    // modify
    val = val >> 7;
    
    return (*Ptr = val);
}

to Autoit.

I've tried it and I got the following result:

Func modify(ByRef $Ptr)
{
    $val = $Ptr

    ;modify
    $val = BitShift($val, 7)
    
    Return $Ptr = $val
}

Can anyone tell me if it is correct translated?

Thanks for help!

You are also new to AutoIt :) Welcome to the forums hibernate.

What you posted is a mixture of AutoIt and C. Curly brackets aren't used in AutoIt to enclose statements.

The next problem is that pointers to variables are more complicated in AutoIt than in C. To deal with them you need to study DllStructCreate. Have a look at that and then come back if you have questions.

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks for your fast help!

I will have a look over it and try it.

// Edit:

I changed some lines and now the function works as expected, thanks!

Result:

Func modify(ByRef $val)
    ;modify
    $val = BitShift($val, 7)
    
    Return $val
EndFunc
Edited by hibernate
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...