octus Posted June 26, 2013 Share Posted June 26, 2013 Hi, I'm trying to implement the following functionality available in Ruby: http://apidock.com/ruby/Array/pack More specifically the use of directive "N", for example: a = [45] puts a.pack('N') (Checks the result with ruby Interactive online http://tryruby.org/levels/1/challenges/0) Is it possible to do this conversion with Autoit? Thank you Link to comment Share on other sites More sharing options...
octus Posted June 26, 2013 Author Share Posted June 26, 2013 Can you give an example please? Thank you. Link to comment Share on other sites More sharing options...
Andreu Posted June 27, 2013 Share Posted June 27, 2013 $a = 45 StringToBinary(Int($a, 1), 3) I can't remember to be honest, but pack('N') is 32 bit Big endian right? I don't know... that returns 0x00340035 though. Link to comment Share on other sites More sharing options...
octus Posted June 27, 2013 Author Share Posted June 27, 2013 Hi Andreu, Thank you for your reply. Yes the directive "N" meaning 32-bit unsigned, network (big-endian) byte order. I'm trying with your example but I think the result is different from that obtained with Ruby: The output with Ruby is: 000000- The output with your AutoIt code: 004005 * The 00 is null (ASCII) 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