home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / lang / fortran / 4683 < prev    next >
Encoding:
Text File  |  1992-12-12  |  1.6 KB  |  39 lines

  1. Newsgroups: comp.lang.fortran
  2. 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
  3. From: lionel@quark.enet.dec.com (Steve Lionel)
  4. Subject: Re: VAX to UNIX (integer*2, *4)
  5. Message-ID: <1992Dec12.203028.23064@e2big.mko.dec.com>
  6. Sender: usenet@e2big.mko.dec.com (Mr. USENET)
  7. Organization: Digital Equipment Corporation
  8. References:   <Bz447J.47u@acsu.buffalo.edu>
  9. Date: Sat, 12 Dec 1992 20:29:59 GMT
  10. Lines: 27
  11.  
  12.  
  13. In article <Bz447J.47u@acsu.buffalo.edu>, v096my2q@ubvmsd.cc.buffalo.edu 
  14. (ZORBA THE GEEK) writes...
  15. >I'm having some problems reading a binary data file that was originally
  16. >written on the vax, on the unix machine. The data consists of 2 and 4 byte 
  17. >integers. I assume that the problem is arising because vax and unix store 
  18. >these number differently. Does anyone have a subroutine that will convert
  19. >vax integer*2 and integer*4 to unix format? Thanks
  20.  
  21. Um, perhaps rather than "the unix machine" you meant to identify some
  22. hardware architecture, such as MIPS, SPARC, Intel x86, etc.  Unix doesn't
  23. define a layout for binary data; it's an operating system.  It's sort of
  24. like the old joke "Is it faster to Chicago or by train?"
  25.  
  26. Anyway, VAX is a "little-endian" architecture, which means that the least
  27. significant binary digits are in the lowest addressed byte.  If you
  28. move little-endian data to a big-endian system (SPARC, some MIPS systems),
  29. you have to reverse the order of the bytes.
  30.  
  31.                 Steve
  32. --
  33. Steve Lionel                    lionel@quark.enet.dec.com
  34. SDT Languages Group
  35. Digital Equipment Corporation
  36. 110 Spit Brook Road
  37. Nashua, NH 03062
  38.