# Binary type

## Recommended Posts

I discover Binary format of AutoIT and i have some question

Dim \$B = Binary( 123456 )
ConsoleWrite( string( \$b ) & @CRLF )
ConsoleWrite( hex( \$b ) & @CRLF )
ConsoleWrite( number( \$b ) & @CRLF )

Result:

0x40E20100

40E20100

64

What is the easiest way to return this "littleendian" store information to is numeric value? (123456 and not 64)

Stéphane

##### Share on other sites

Dec

--------------------------------------------------------------------------------

Returns a numeric representation of a hexadecimal string.

ConsoleWrite( dec(hex( \$b )) & @CRLF )

i havent tested, and there may be a better solution.

You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!"

##### Share on other sites

Dim \$A = 123456
Dim \$B = Binary(\$A)
ConsoleWrite(Hex(\$A) & @LF)
ConsoleWrite(\$B & @LF)
ConsoleWrite(String(\$B) & @LF)
ConsoleWrite(Hex(\$B) & @LF)
ConsoleWrite(Number(\$B) & @LF)

For \$n = BinaryLen(\$B) To 1 Step -1
ConsoleWrite(@TAB & BinaryMid(\$B, \$n, 1) & @LF)
Next

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

##### Share on other sites

So it works this way:

Dim \$A = 123456
Dim \$B = Binary(\$A)

\$hex = ""
For \$n = BinaryLen(\$B) To 1 Step -1
\$hex &= Hex(BinaryMid(\$B, \$n, 1))
Next
ConsoleWrite(Dec(\$hex)& @CRLF)

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

##### Share on other sites

Ok thanx for this reply but its not an efficient way of doing thing, i have to play with realy big files 1Gb++

So this way is not the fastest ...

if i convert an hex string to binary, the conversion dont do "littleendian" reorder

Proof:

\$A = Binary( 1024 )
ConsoleWrite( hex( \$A ) & @CRLF )
\$A = Binary( "0x" & Hex(1024 ) )
ConsoleWrite( hex( \$A ) & @CRLF )

Output:
00040000
00000400

Is there a function like the hex one that convert back a binary to a "number" format, who does the reverse of Binary( 1024 ) ??

Hex is like the reverse of Binary( "0x00000400" )

Any more idea?

Thanx

Stéphane

## Create an account

Register a new account

×

• Wiki

• Back

• Git