I have been using runrev studio for about a month now and have found it very intuative to use while parsing text files into other formats, but when it comes to binary (hex) I am totally confused.
I want to read a binary file containg encrypted latitude and longditude data at offset $200 for 1 byte, evaluate the hex value of that byte, then depending on the hex value of that char, I would read then next 4 bytes into a variable say varLatitude then then the next 4 bytes into varEncryptedLongditude. To decrypt this data I need to XOR the two variables, the 4 byte answer would be the decrypted Longditude.
Now another problem is that these specific 4 byte strings are in 2's compliment notation (negative numbers being south and west, positive bieng north and east) they also appear to be written to the file back to front, (I believe this is something to do with Big Endian or Little endian)
The data was created on win32 and my runrev project will ony ever run on win32 so at least there are no cross platform issues to worry about here?
Maybe I have bitten off more than i can chew here for a begginer? But I really want to push my abilities in this area and i find the best way is to dive in!
Binary files have got me beat!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
I can't tell you how exactly to do this, but I can give you some info that could get you started:
First you need to get to your binary data. If it's not a huge multy megabytes file, you can put the whole thing into a var (but not a field, as fields mangle binary).
put url "binfile:path/to/your/file.binary" into yourBinaryData
local ignoredJunk, theResultingVar
BinaryDecode(x300a4,yourBinaryData,ignoredJunk,theResultingVar)
With binarydecode, you can translate almost every binary data to something more usefull. The above example ignores the first 300 bytes, reads 4 bytes, converts them to characters and puts the characters into theResultingVar. BinaryDecode is a bit special, in that the actual data is put into a variable you specify, also note that the variable must already exist!
you can try other conversions, if this doesn't give you expected results, so read the documentation entry carefully to understand the differences. Especially tak care of the note about "a" && anyNumber always giving you one var, whereas most others give you anyNumber of different vars.
First you need to get to your binary data. If it's not a huge multy megabytes file, you can put the whole thing into a var (but not a field, as fields mangle binary).
put url "binfile:path/to/your/file.binary" into yourBinaryData
local ignoredJunk, theResultingVar
BinaryDecode(x300a4,yourBinaryData,ignoredJunk,theResultingVar)
With binarydecode, you can translate almost every binary data to something more usefull. The above example ignores the first 300 bytes, reads 4 bytes, converts them to characters and puts the characters into theResultingVar. BinaryDecode is a bit special, in that the actual data is put into a variable you specify, also note that the variable must already exist!
you can try other conversions, if this doesn't give you expected results, so read the documentation entry carefully to understand the differences. Especially tak care of the note about "a" && anyNumber always giving you one var, whereas most others give you anyNumber of different vars.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode