hibernate Posted March 5, 2011 Share Posted March 5, 2011 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 More sharing options...
martin Posted March 5, 2011 Share Posted March 5, 2011 (edited) 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 March 5, 2011 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 More sharing options...
hibernate Posted March 5, 2011 Author Share Posted March 5, 2011 (edited) 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 March 5, 2011 by hibernate Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 5, 2011 Share Posted March 5, 2011 Why are you using both Return and ByRef? .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now