Jump to content

read file to bytearray


 Share

Recommended Posts

  • Moderators

Have you looked in the help file at the binary functions, such as BinaryToString, StringToBinary, etc?

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Want do you want/need to perform exactly? With an answer to this question it might be possible to guide you towards a simple and efficient solution ... or not.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Moderators

I am sure someone will come along with a regex or something that works as well, but this works for me.

 

#include <Array.au3>
 
Local $aArray2[1] = [""]
$sBinary = "0xFD3EDFC4"
$aArray = StringSplit($sBinary, "")
 
For $i = 3 To $aArray[0] Step 2
  _ArrayAdd($aArray2, $aArray[1] & $aArray[2] & $aArray[$i] & $aArray[$i + 1])
Next
 
_ArrayDelete($aArray2, 0)
 _ArrayDisplay($aArray2)

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

sorry for my bad english 

this can be an alternative using a function that can also be useful for other examples
#Include <Array.au3>
$sBinary = "0xFD3EDFC4"
$count=2

$stringsplit_array=stringsplit_count($sBinary,$count) 

For $i = 1 To ubound($stringsplit_array)-1
  $stringsplit_array[$i]=$stringsplit_array[0]&$stringsplit_array[$i]
Next 
_ArrayDelete($stringsplit_array, 0)
_ArrayDisplay($stringsplit_array)

func stringsplit_count($string,$count)
    if $string="" Then
        return SetError(-1, 0, 0)
    else
        $stringlen=stringlen($string)
        $div=int($stringlen/$count)
        if $stringlen<>$count*$div then $div+=1
        dim $stringsplit_array[$div]
        for $i=0 to $div-1
            if $i=0 then
                $ii=1
            Else
                $ii+=$count
            EndIf
            $stringsplit_array[$i]=stringmid($string,$ii,$count)
        Next
        SetError(1, 0, 0)
        return $stringsplit_array
    endif
endfunc

To community goes all my regards and thanks

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