Jump to content
Sign in to follow this  
amel27

Reading binary data - Bag or not?

Recommended Posts

amel27

since new Unicode AutoIT versions this lengths not equal:

$u = DllStructCreate ('byte[10]')
ConsoleWrite ("Size of structure: "& DllStructGetSize ($u) &@CRLF)
ConsoleWrite ("Size of data in structure: "& StringLen (DllStructGetData ($u,1)) &@CRLF)oÝ÷ Ù«­¢+ØÀÌØíÍ¥±ô]¥¹½ÝͥȵÀìÌäìÀäÈíÍÑÕÁй±½Ìäì(ÀÌØí¡¥±ô¥±=Á¸ ÀÌØíÍ¥±°Ð¤()
½¹Í½±]É¥Ñ ÅÕ½ÐíM¥é½¥±èÅÕ½ÐìµÀ쥱ÑM¥é ÀÌØíÍ¥±¤µÀí
I1¤)
½¹Í½±]É¥Ñ ÅÕ½ÐíM¥é½Ñ¥¸¥±èÅÕ½ÐìµÀìMÑÉ¥¹1¸¡¥±I ÀÌØí¡¥±±¥±ÑM¥é ÀÌØíÍ¥±¤¤¤µÀí
I1¤)¥±
±½Í ÀÌØí¡¥±¤

Share this post


Link to post
Share on other sites
weaponx

Why is there 2 different scripts? Are they both broken?

Share this post


Link to post
Share on other sites
rover

#include <String.au3>

$sFile = @WindowsDir & '\setupact.log'
$hFile = FileOpen($sFile,4) ; Read raw mode
$test =  FileRead($hFile,FileGetSize($sFile))
MsgBox(0, "Binary", $test) ; content is binary
MsgBox(0, "String", BinaryToString($test))
ConsoleWrite ("Size of file: "& FileGetSize($sFile) &@CRLF)
ConsoleWrite ("Size of data in file: "& StringLen(BinaryToString($test)) &@CRLF)
ConsoleWrite ("Size of data in file: "& StringLen(BinaryToString(FileRead($hFile))) &@CRLF) ; fails
FileClose($hFile)
;------------------------------------------------------------------------------------
$sFile = @WindowsDir & '\setupact.log'
$hFile = FileOpen($sFile,0) ; Read Mode
$test =  FileRead($hFile,FileGetSize($sFile))
MsgBox(0, "Binary", $test) ; content is string
MsgBox(0, "String", BinaryToString($test))
ConsoleWrite ("Size of file: "& FileGetSize($sFile) &@CRLF)
ConsoleWrite ("Size of data in file: "& StringLen(BinaryToString($test)) &@CRLF)
ConsoleWrite ("Size of data in file: "& StringLen(BinaryToString(FileRead($hFile))) &@CRLF) ; fails
FileClose($hFile)

$u = DllStructCreate ('byte[10]')
ConsoleWrite ("Size of structure: "& DllStructGetSize ($u) &@CRLF)
ConsoleWrite ("Size of data in structure: "& BinaryLen (DllStructGetData ($u,1)) &@CRLF)


I see fascists...

Share this post


Link to post
Share on other sites
amel27

Thanks rover!

I see that now Binary data type are closed... But how direct editing binary data without converting it to string?

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  

×