hibernate 0 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! Share this post Link to post Share on other sites
martin 85 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. Share this post Link to post Share on other sites
hibernate 0 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 Share this post Link to post Share on other sites
AdmiralAlkex 125 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 Share this post Link to post Share on other sites