Hi Rodney: At 03:07 PM 6/5/00 -0700, you wrote: >One problem I can see with the solution of: > >to-integer head reverse #{A1020000} > >is that this is assuming reverse-byte storage which is >dependent on the platform (processor) where the script is Even with the same processor, one could have different results, such as Linux on x86 as opposed to Windows, this could be an interesting can of worms, What? -Tim >being executed. The same script would not run correctly >on all platforms (ie. it would break on 68000 instead of 'X86). > >I haven't tried this kind of thing as of yet but maybe >someone else has another idea? Surely this has been encountered by now. > >Rodney Snell > > >-----Original Message----- >From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] >Sent: Monday, June 05, 2000 2:36 PM >To: [EMAIL PROTECTED] >Subject: [REBOL] Reading Binary Data to integers Re: > > > > >[EMAIL PROTECTED] wrote: > >> I'd like to use rebol to read from binary data that >> has been written by C programs. >> >> As a test: >> >> 1) C function writes 0x000002A1 // decimal 673 >> as a long integer to a four-byte file. >> >> 2)Data is stored in byte-reverse order as A1 02 00 00 >> >> I then wrote the following rebol script: >> >> print test: read/binary/part %TestIO.txt 4 >> print test: to-integer test >> ;results are >> #{A1020000} >> -1593704448 >> >> So how do I read the file so the original value is >> returned? > > to-integer head reverse #{A1020000} > >-pekr- > >> >> >> TIA >> -Tim > >