Jump to content
Sign in to follow this  
JRowe

Array to binary, save as file, reload?

Recommended Posts

JRowe

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?

Share this post


Link to post
Share on other sites
ludocus

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)

Share this post


Link to post
Share on other sites
JRowe
youknowwho4eva

Hopefully that's not Jenny's real number, she might not be to happy.


Giggity

Share this post


Link to post
Share on other sites
JRowe
JRowe

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.

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
JRowe

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:

Share this post


Link to post
Share on other sites
monoceres

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!

Share this post


Link to post
Share on other sites
Valuater

_FileReadToArray() and _FileWriteFromArray

???

8)


NEWHeader1.png

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.