Hi Mark,

Great! Thanks a lot. I think it would be good to have an Endian Converter built into RunRev - would save a lot of mucking about.

One more thing (isn't there always?!). Is there anyway to read back the current position of the file?

Thanks again
All the Best
Dave

On 8 Jan 2008, at 13:23, Mark Smith wrote:

That's right - the initialization figures out the endianness of the system it's running on. It's necessary to know the endianness of the system it's running on so that it does the right thing with it's inputs.

For instance, in your case, the input is little-endian whatever kind of system you're running, so if your system is also little- endian, it doesn't need to reverse the bytes before decoding, whereas if your system is big-endian, it knows it has to reverse the bytes before decoding. The bug (now fixed in 2.9 beta) was with the 'n' and 'N' binary decode specifiers, which aren't used in the library, so weren't a factor.

Assuming your case is unsigned, little-endian integers, you'd use getUIntLE().

Best,

Mark



On 8 Jan 2008, at 12:00, Dave wrote:

Hi Mark,

Thanks a bunch! I was just playing binaryEncode/Decode when you mail popped up. I've downloaded the stack. One quick question though. In the Initialization you set the the endian flag, is this is based on the type of system you are running on? e.g. (Big or Little Endian?). If so is this because of the bug you mentioned in the readme file?

 Thanks again and All the Best
Dave

On 8 Jan 2008, at 11:34, Mark Smith wrote:

Dave, you can download a small library I wrote for exactly this sort of thing:
go to  http://www.futility.co.uk/futsoft/revolutionstuff.html

and download libBinConvert.

If you don't want to have to use yet another library, you can just copy the appropriate function ( getIntLE() or getUIntLE() ) out of the library.

Best,

Mark

On 8 Jan 2008, at 11:19, Dave wrote:

Hi,

I've tried a few things, such as:

put empty into myData
repeat 4 times
read from file myFile for 1 char
put it before myData
end repeat

But this doesn't work - just returns 0.

Not sure how to go about this in RunRev, although in C it was be sooooooooooooooooooooo simple!

All the Best
Dave

On 8 Jan 2008, at 11:13, Mark Schonewille wrote:

Hi Dave,

You need to write a function to revert the numbers manually. I'd say that's an easy task to do.

Best regards,

Mark Schonewille

--

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz

Quickly extract data from your HyperCard stacks with DIFfersifier. http://differsifier.economy-x-talk.com


Op 8-jan-2008, om 12:08 heeft Dave het volgende geschreven:

Happy New Year to All!

Does anyone know of an easy way to read a 4 bytes (32 bit) little endian number from a file?

I am running on a Mac and the file I am trying to process *always* is stored in Little Endian Format, for instance:

The number 0x00000000BC   (188) is stored in the file as:

0xBC000000 (a VERY large number!)

I want to get 188 when I read these four bytes.

Any ideas???

Thanks a lot
All the Best
Dave


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to