Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8729
| From | David Bailey <dave@removedbailey.co.uk> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Reading Single and Double reals in Little-endian and Big-endian |
| Date | 2012-02-25 06:55 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jia0kh$196$1@smc.vnet.net> (permalink) |
| References | <jhldir$ot7$1@smc.vnet.net> <jhsu7g$np4$1@smc.vnet.net> <ji794s$hcs$1@smc.vnet.net> |
On 24/02/2012 06:02, ezh wrote: > Yes, it's an old Mathematica. I pay for it myself, that's why. > > Yes, I need to reverse the byte order. After all, it's not a PC > storing the stuff read from the file, it's Mathematica. In any case, > this is not a theoretical statement. I tried it > > Here's the work-around I developed: > > strm1= open orginal file for input > strm2= open "reversed' file for output. > copy the strm1 file to the strm2 file, but > At each 4-byte floating number in the input file: > stuff=ReadBinaryList[strm1,Byte,4] > WriteBinary[strm2,Reverse[stuff],ByteConversion -> (ToBytes[#, > IntegerConvert -> Byte]&)] > Now close the files. > The "reversed" file is the same as the original file, but with each 4- > byte floating number in the opposite byte order > > Now open the "reversed" file for binary input. > Now > value=ReadBinary[strm,Single]; > gets the right value. > I wonder if you would be eligible for this license: http://www.wolfram.com/mathematica/how-to-buy/hobbyist.html David Bailey http://www.dbaileyconsultancy.co.uk
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Reading Single and Double reals in Little-endian and Big-endian ezh <dgolber@aol.com> - 2012-02-17 11:27 +0000
Re: Reading Single and Double reals in Little-endian and Big-endian "Oleksandr Rasputinov" <oleksandr_rasputinov@ymail.com> - 2012-02-20 07:54 +0000
Re: Reading Single and Double reals in Little-endian and Big-endian ezh <dgolber@aol.com> - 2012-02-24 06:02 +0000
Re: Reading Single and Double reals in Little-endian and Big-endian David Bailey <dave@removedbailey.co.uk> - 2012-02-25 06:55 +0000
Re: Reading Single and Double reals in Little-endian and Big-endian "Oleksandr Rasputinov" <oleksandr_rasputinov@ymail.com> - 2012-02-26 09:21 +0000
csiph-web