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

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!haven.umd.edu!decuac!pa.dec.com!rdg.dec.com!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: swapping bytes on a two byte integer
  5. Message-ID: <1992Dec15.172455.12204@e2big.mko.dec.com>
  6. Lines: 24
  7. Sender: usenet@e2big.mko.dec.com (Mr. USENET)
  8. Reply-To: lionel@quark.enet.dec.com (Steve Lionel)
  9. Organization: Digital Equipment Corporation, Nashua NH
  10. References:  <BzB6rI.LI7@acsu.buffalo.edu>
  11. Date: Tue, 15 Dec 1992 17:24:55 GMT
  12.  
  13.  
  14. In article <BzB6rI.LI7@acsu.buffalo.edu>, acscmaw@ubvmsb.cc.buffalo.edu 
  15. (MARK WIECZOREK) writes:
  16. |>
  17. |>I have a very simple problem. I have a binary data file composed of two byte
  18. |>integers. After reading the data I would like to change the order of the 
  19. |>bytes and write the result to a file. I've looked through the vax fortran
  20. |>manuals and couldn't find a way to do this. Any help would be greatly
  21. |>appreciated. 
  22. |>
  23.  
  24. The simplest way is to use ISHFTC(value,8,16).  If you have a lot of these to
  25. do and want something faster, you can define the variable as a record structure
  26. with two byte elements and swap the bytes yourself.
  27.  
  28. The next major release of Fortran for OpenVMS VAX will have a feature that will
  29. do the byte-swapping for you on input or output, if selected.
  30. --
  31.  
  32. Steve Lionel                    lionel@quark.enet.dec.com
  33. SDT Languages Group
  34. Digital Equipment Corporation
  35. 110 Spit Brook Road
  36. Nashua, NH 03062
  37.