Re: Bytes into integer
Re: Bytes into integer
- Subject: Re: Bytes into integer
- From: Emmanuel <email@hidden>
- Date: Fri, 13 Feb 2004 15:36:12 +0100
At 8:31 AM -0500 2/13/04, Steve Roy wrote:
>
I'm trying to extract a value out of a binary file with AppleScript. I have to
>
read three bytes and turn them into an integer.
If indeed your integers are coded on 3 bytes, then I discard my post.
However if you're working with a standard binary file, where numbers are stored as an even number of bytes, then you may be underestimating AppleScript's "read" command: you can "read as small integer" (2-bytes integer), "read as integer" (4-bytes integer), "read as double integer" (8-bytes integer), "read as small real" (4-bytes real) and "read as real" (8-bytes real).
Finally, in case you don't know, the Satimage osax proposes a "read binary" command, which is rather versatile and may help you.
The Satimage osax is one of the scientific resources that Satimage-software makes freely available to the AppleScript community at <
http://www.satimage-software.com>.
Emmanuel
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.