Jump to content

Array to binary, save as file, reload?


JRowe
 Share

Recommended Posts

Can I create an array, then convert it's binary form into a string, and then back into an array?

I know I can get the data from each element, but I was wondering if there was a way to access and store the structure directly. :mellow:

Dim $test[10]
$test[0] = "Blah Blah"
$test[1] = 123
$test[2] = "Will this work?"
$test[3] = 444
$test[4] = "xyzzy"
$test[5] = $test[4]
$test[6] = "xyzzy... third time's a charm, amirite?"
$test[7] = 90210
$test[8] = "Jenny... what's your number?"
$test[9] = 8675309

$binary = Binary($test)

msgbox(0, "Display the binary data representing the whole array",$binary)

That works on elements when $binary = Binary($test) is changed to $test[1], etc. It doesn't work for the whole array. Anyone know if this is doable?

Link to comment
Share on other sites

this would to the job:

#include <Array.au3>
Dim $test[10]
$test[0] = "Blah Blah"
$test[1] = 123
$test[2] = "Will this work?"
$test[3] = 444
$test[4] = "xyzzy"
$test[5] = $test[4]
$test[6] = "xyzzy... third time's a charm, amirite?"
$test[7] = 90210
$test[8] = "Jenny... what's your number?"
$test[9] = 8675309

$binary = Binary(_ArrayToString($test))

msgbox(0, "Display the binary data representing the whole array",$binary)
Link to comment
Share on other sites

Not quite what I was aiming for, by the way. What I want to do is literally rip the binary of the array itself out of memory, not just the delimited elements in a string.

Link to comment
Share on other sites

Not quite what I was aiming for, by the way. What I want to do is literally rip the binary of the array itself out of memory, not just the delimited elements in a string.

I'm not sure how you mean but maybe you could save your data in a struct? That way you can have complete access to the "raw" data through a pointer.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

My idea was to save the array as a file, without having to parse it. Also, knowing the format of an autoit array in memory opens up possibilities with the plugin sdk.

I'd fill my array, write it to disk as something like a myArray.array file, then open it later , something like

$myNewArray = fileOpen("myArray.array")
to retrieve the data written with the first script, in native AutoIt array format.

I tried a while back never got anywhere, but I never asked either, so I thought I'd ask this time :mellow:

Link to comment
Share on other sites

My idea was to save the array as a file, without having to parse it. Also, knowing the format of an autoit array in memory opens up possibilities with the plugin sdk.

I'd fill my array, write it to disk as something like a myArray.array file, then open it later , something like

$myNewArray = fileOpen("myArray.array")
to retrieve the data written with the first script, in native AutoIt array format.

I tried a while back never got anywhere, but I never asked either, so I thought I'd ask this time :mellow:

In my media player project (which is abandoned btw) I stored my playlist (along with the ID3 tags of the songs) in structs, then later when I wanted to save/load my playlists I just used _WinAPI_ReadFile()/WriteFile(). I managed to save/load 7000+ songs ID3 data < 1 second.

Broken link? PM me and I'll send you the file!

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