Sign in to follow this  
Followers 0
EddieBoy

binary() returning a 64bit value?

3 posts in this topic

I'm trying to calculate the size of a data block then write that value to a file in binary format. But binary() isn't behaving as I would expect and seems to be returning an 8 byte value. Here's a simplified example. Any advice on why this happens would be appreciated :graduated:

$Width = 0x100
$Height = 0x100
$BPP= 0x18
$Image_Data_Size =int($Width)*int($Height)*(int($BPP/8))
ConsoleWrite($Image_Data_Size & @CRLF)
ConsoleWrite(Binary($Image_Data_Size) & @CRLF)
ConsoleWrite(Binary(196608)& @CRLF)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

AutoIt changes the variable type automatically to int64 if is required. Maybe AutoIt thinks so in your case.

Edit: Yes this is the cause.

Edited by ProgAndy

*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 this post


Link to post
Share on other sites

That helps thanks- drove myself crazy trying to figure out what was going on :graduated:

Is there something I can change in the code to stop that from happening or should I fix it with something like BinaryMid($num,1,4)?

Share this post


Link to post
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
Sign in to follow this  
Followers 0