Jump to content

Reading binary data - Bag or not?


Recommended Posts

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¤)¥±
±½Í ÀÌØí¡¥±¤
Link to comment
Share on other sites

#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...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...