home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!elroy.jpl.nasa.gov!decwrl!deccrl!news.crl.dec.com!dbased.nuo.dec.com!e2big.mko.dec.com!quark.enet.dec.com!lionel
- From: lionel@quark.enet.dec.com (Steve Lionel)
- Subject: Re: VAX to UNIX (integer*2, *4)
- Message-ID: <1992Dec12.203028.23064@e2big.mko.dec.com>
- Sender: usenet@e2big.mko.dec.com (Mr. USENET)
- Organization: Digital Equipment Corporation
- References: <Bz447J.47u@acsu.buffalo.edu>
- Date: Sat, 12 Dec 1992 20:29:59 GMT
- Lines: 27
-
-
- In article <Bz447J.47u@acsu.buffalo.edu>, v096my2q@ubvmsd.cc.buffalo.edu
- (ZORBA THE GEEK) writes...
- >I'm having some problems reading a binary data file that was originally
- >written on the vax, on the unix machine. The data consists of 2 and 4 byte
- >integers. I assume that the problem is arising because vax and unix store
- >these number differently. Does anyone have a subroutine that will convert
- >vax integer*2 and integer*4 to unix format? Thanks
- >
-
- Um, perhaps rather than "the unix machine" you meant to identify some
- hardware architecture, such as MIPS, SPARC, Intel x86, etc. Unix doesn't
- define a layout for binary data; it's an operating system. It's sort of
- like the old joke "Is it faster to Chicago or by train?"
-
- Anyway, VAX is a "little-endian" architecture, which means that the least
- significant binary digits are in the lowest addressed byte. If you
- move little-endian data to a big-endian system (SPARC, some MIPS systems),
- you have to reverse the order of the bytes.
-
- Steve
- --
- Steve Lionel lionel@quark.enet.dec.com
- SDT Languages Group
- Digital Equipment Corporation
- 110 Spit Brook Road
- Nashua, NH 03062
-